How to configure GN Ninja files when adding includes in Google Chromium source code?

  c++, chromium, gn, linux

I’m developing new features for an old version of Google Chrome (71.0.3578.141).

In the file src/content/browser/devtools/protocol/page_handler.cc, I need to add the following includes:

src/content/browser/devtools/protocol/page_handler.cc:

#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"

When I execute gn check out/Default, the output is:

ERROR at //content/browser/devtools/protocol/page_handler.cc:8:11: Include not allowed.
#include "chrome/browser/ui/browser_list.h"
          ^-------------------------------
It is not in any dependency of
  //content/browser:browser
The include file is in the target(s):
  //chrome/browser/ui:ui
which should somehow be reachable.
___________________
ERROR at //content/browser/devtools/protocol/page_handler.cc:9:11: Include not allowed.
#include "chrome/browser/ui/browser.h"
          ^--------------------------
It is not in any dependency of
  //content/browser:browser
The include file is in the target(s):
  //chrome/browser/ui:ui
which should somehow be reachable.
___________________
ERROR at //content/browser/devtools/protocol/page_handler.cc:10:11: Include not allowed.
#include "chrome/browser/ui/browser_window.h"
          ^---------------------------------
It is not in any dependency of
  //content/browser:browser
The include file is in the target(s):
  //chrome/browser/ui:ui
which should somehow be reachable.

Sorry but I’m a newbie and I don’t know how the GN (Ninja) tool works. I think that I have to modify some BUILD.gn files (or any other GN config files) but I don’t know where to start. Please, can anyone help me? Thanks in advance!

Source: Windows Questions C++

LEAVE A COMMENT