Commit 344272dd authored by tapted's avatar tapted Committed by Commit bot

Move components/native_app_window to extensions/components/native_app_window

There's currently a dependency cycle between gyp files: components.gyp
and extensions.gyp. extensions.gyp depends on a number of components,
and two components depend on exetensions.gyp. These are:
 - components/renderer_context_menu/
 - components/native_app_window/ (more recently)

renderer_context_menu has an "optional" extensions dependency, which can
be skipped when ENABLE_EXTENSIONS is not defined. Still, it is necessary
for renderer_context_menu.gyp to omit its extensions.gyp dependency and
build as a static library.

For native_app_window, since it is not compiled on Mac, the gyp circular
check is not performed on the bots.

This CL fixes the layering by adding a folder,
src/extensions/components. Things here may depend on extensions, but not
on other extensions/components folders in a way that creates a cycle.
This also allows the benefits of a component-architecture to make sense
of interdependencies between the ~1337 files under src/extensions.

This layout also makes it clear that by depending on one of these
components, a target is also depending on src/extensions. Currently,
this is not clear.

BUG=35878, 418455
TBR=reed@google.com

Review URL: https://codereview.chromium.org/606953002

Cr-Commit-Position: refs/heads/master@{#297952}
parent c4c7e842
...@@ -63,6 +63,7 @@ static_library("apps") { ...@@ -63,6 +63,7 @@ static_library("apps") {
"ui/views/app_window_frame_view.h", "ui/views/app_window_frame_view.h",
] ]
deps += [ deps += [
"//extensions/browser",
"//ui/strings", "//ui/strings",
"//ui/views", "//ui/views",
] ]
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
], ],
['toolkit_views==1', { ['toolkit_views==1', {
'dependencies': [ 'dependencies': [
'../components/components.gyp:native_app_window', '../extensions/extensions.gyp:extensions_browser',
'../ui/strings/ui_strings.gyp:ui_strings', '../ui/strings/ui_strings.gyp:ui_strings',
'../ui/views/views.gyp:views', '../ui/views/views.gyp:views',
], ],
......
...@@ -128,13 +128,13 @@ ...@@ -128,13 +128,13 @@
'athena_lib', 'athena_lib',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../components/components.gyp:component_metrics_proto', '../components/components.gyp:component_metrics_proto',
'../components/components.gyp:native_app_window',
'../components/components.gyp:omnibox', '../components/components.gyp:omnibox',
'../components/components.gyp:renderer_context_menu', '../components/components.gyp:renderer_context_menu',
'../components/components.gyp:web_modal', '../components/components.gyp:web_modal',
'../content/content.gyp:content_browser',
'../extensions/components/extensions_components.gyp:native_app_window',
'../extensions/extensions.gyp:extensions_browser', '../extensions/extensions.gyp:extensions_browser',
'../extensions/extensions.gyp:extensions_common', '../extensions/extensions.gyp:extensions_common',
'../content/content.gyp:content_browser',
'../ui/app_list/app_list.gyp:app_list', '../ui/app_list/app_list.gyp:app_list',
'../ui/keyboard/keyboard.gyp:keyboard', '../ui/keyboard/keyboard.gyp:keyboard',
'../ui/keyboard/keyboard.gyp:keyboard_resources', '../ui/keyboard/keyboard.gyp:keyboard_resources',
......
...@@ -2,10 +2,10 @@ include_rules = [ ...@@ -2,10 +2,10 @@ include_rules = [
"+athena/env/public", "+athena/env/public",
"+athena/activity/public", "+athena/activity/public",
"+athena/home/public", "+athena/home/public",
"+components/native_app_window",
"+content/public/browser", "+content/public/browser",
"+extensions/browser", "+extensions/browser",
"+extensions/common", "+extensions/common",
"+extensions/components/native_app_window",
"+extensions/grit", "+extensions/grit",
"+ui/app_list", "+ui/app_list",
"+ui/aura", "+ui/aura",
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef ATHENA_EXTENSIONS_ATHENA_NATIVE_APP_WINDOW_VIEWS_H_ #ifndef ATHENA_EXTENSIONS_ATHENA_NATIVE_APP_WINDOW_VIEWS_H_
#define ATHENA_EXTENSIONS_ATHENA_NATIVE_APP_WINDOW_VIEWS_H_ #define ATHENA_EXTENSIONS_ATHENA_NATIVE_APP_WINDOW_VIEWS_H_
#include "components/native_app_window/native_app_window_views.h" #include "extensions/components/native_app_window/native_app_window_views.h"
namespace athena { namespace athena {
......
...@@ -79,7 +79,6 @@ static_library("browser") { ...@@ -79,7 +79,6 @@ static_library("browser") {
"//components/metrics:net", "//components/metrics:net",
"//components/metrics:profiler", "//components/metrics:profiler",
"//components/metrics/proto:proto", "//components/metrics/proto:proto",
"//components/native_app_window",
"//components/navigation_metrics", "//components/navigation_metrics",
"//components/network_time", "//components/network_time",
"//components/omaha_query_params", "//components/omaha_query_params",
...@@ -236,9 +235,6 @@ static_library("browser") { ...@@ -236,9 +235,6 @@ static_library("browser") {
#"browser_app_shim" TODO(GYP) #"browser_app_shim" TODO(GYP)
] ]
} }
if (!toolkit_views) {
deps -= [ "//components/native_app_window" ]
}
if (cld2_data_source == "component") { if (cld2_data_source == "component") {
sources += [ sources += [
"component_updater/cld_component_installer.cc", "component_updater/cld_component_installer.cc",
......
...@@ -4,8 +4,8 @@ include_rules = [ ...@@ -4,8 +4,8 @@ include_rules = [
"+athena/screen/public", "+athena/screen/public",
"+athena/util", "+athena/util",
"+components/captive_portal", "+components/captive_portal",
"+components/native_app_window",
"+components/user_manager", "+components/user_manager",
"+extensions/components/native_app_window",
# Library used for calculating CRC-32 needed for HWID verification. # Library used for calculating CRC-32 needed for HWID verification.
"+third_party/zlib", "+third_party/zlib",
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#include "chromeos/chromeos_switches.h" #include "chromeos/chromeos_switches.h"
#include "chromeos/dbus/cryptohome_client.h" #include "chromeos/dbus/cryptohome_client.h"
#include "chromeos/disks/disk_mount_manager.h" #include "chromeos/disks/disk_mount_manager.h"
#include "components/native_app_window/native_app_window_views.h"
#include "components/signin/core/common/signin_pref_names.h" #include "components/signin/core/common/signin_pref_names.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_observer.h"
...@@ -57,6 +56,7 @@ ...@@ -57,6 +56,7 @@
#include "extensions/browser/app_window/app_window_registry.h" #include "extensions/browser/app_window/app_window_registry.h"
#include "extensions/browser/app_window/native_app_window.h" #include "extensions/browser/app_window/native_app_window.h"
#include "extensions/browser/extension_system.h" #include "extensions/browser/extension_system.h"
#include "extensions/components/native_app_window/native_app_window_views.h"
#include "extensions/test/extension_test_message_listener.h" #include "extensions/test/extension_test_message_listener.h"
#include "extensions/test/result_catcher.h" #include "extensions/test/result_catcher.h"
#include "google_apis/gaia/gaia_constants.h" #include "google_apis/gaia/gaia_constants.h"
......
...@@ -205,6 +205,7 @@ static_library("ui") { ...@@ -205,6 +205,7 @@ static_library("ui") {
sources += rebase_path( sources += rebase_path(
gypi_values.chrome_browser_ui_views_non_mac_sources, gypi_values.chrome_browser_ui_views_non_mac_sources,
".", "//chrome") ".", "//chrome")
deps += [ "//extensions/components/native_app_window" ]
} }
if (use_ash) { if (use_ash) {
sources += rebase_path(gypi_values.chrome_browser_ui_ash_views_sources, sources += rebase_path(gypi_values.chrome_browser_ui_ash_views_sources,
......
include_rules = [ include_rules = [
"+components/native_app_window" "+extensions/components/native_app_window"
] ]
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_ #define CHROME_BROWSER_UI_VIEWS_APPS_CHROME_NATIVE_APP_WINDOW_VIEWS_H_
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "components/native_app_window/native_app_window_views.h" #include "extensions/components/native_app_window/native_app_window_views.h"
#include "ui/views/context_menu_controller.h" #include "ui/views/context_menu_controller.h"
namespace apps { namespace apps {
......
...@@ -3005,11 +3005,6 @@ ...@@ -3005,11 +3005,6 @@
'browser/metrics/signin_status_metrics_provider.h', 'browser/metrics/signin_status_metrics_provider.h',
], ],
}], }],
['toolkit_views==1', {
'dependencies': [
'../components/components.gyp:native_app_window',
],
}],
['enable_extensions==1', { ['enable_extensions==1', {
'dependencies': [ 'dependencies': [
'browser_extensions', 'browser_extensions',
......
...@@ -2738,6 +2738,9 @@ ...@@ -2738,6 +2738,9 @@
}], }],
['OS!="mac"', { ['OS!="mac"', {
'sources': [ '<@(chrome_browser_ui_views_non_mac_sources)' ], 'sources': [ '<@(chrome_browser_ui_views_non_mac_sources)' ],
'dependencies': [
'<(DEPTH)/extensions/components/extensions_components.gyp:native_app_window',
],
}], }],
], ],
}], }],
......
...@@ -51,7 +51,6 @@ group("all_components") { ...@@ -51,7 +51,6 @@ group("all_components") {
"//components/language_usage_metrics", "//components/language_usage_metrics",
"//components/leveldb_proto", "//components/leveldb_proto",
"//components/metrics", "//components/metrics",
"//components/native_app_window",
"//components/navigation_interception", "//components/navigation_interception",
"//components/navigation_metrics", "//components/navigation_metrics",
"//components/network_time", "//components/network_time",
...@@ -113,10 +112,6 @@ group("all_components") { ...@@ -113,10 +112,6 @@ group("all_components") {
if (!is_chromeos) { if (!is_chromeos) {
deps -= [ "//components/pairing" ] deps -= [ "//components/pairing" ]
} }
if (!toolkit_views) {
deps -= [ "//components/native_app_window" ]
}
if (is_ios) { if (is_ios) {
deps -= [ "//components/keyed_service/content" ] deps -= [ "//components/keyed_service/content" ]
} }
......
...@@ -98,10 +98,6 @@ per-file nacl*=mseaborn@chromium.org ...@@ -98,10 +98,6 @@ per-file nacl*=mseaborn@chromium.org
per-file nacl*=noelallen@chromium.org per-file nacl*=noelallen@chromium.org
per-file nacl*=teravest@chromium.org per-file nacl*=teravest@chromium.org
per-file native_app_window*=benwells@chromium.org
per-file native_app_window*=jackhou@chromium.org
per-file native_app_window*=jamescook@chromium.org
per-file navigation_interception.gypi=mkosiba@chromium.org per-file navigation_interception.gypi=mkosiba@chromium.org
per-file network_time.gypi=zea@chromium.org per-file network_time.gypi=zea@chromium.org
......
...@@ -112,11 +112,6 @@ ...@@ -112,11 +112,6 @@
'invalidation.gypi', 'invalidation.gypi',
], ],
}], }],
['toolkit_views==1', {
'includes': [
'native_app_window.gypi',
],
}],
['enable_plugins==1', { ['enable_plugins==1', {
'includes': [ 'includes': [
'pdf.gypi', 'pdf.gypi',
......
include_rules = [
"+base",
"+content/public/browser",
"+extensions/browser/app_window",
"+extensions/common",
"+ui/aura",
"+ui/gfx",
"+ui/views",
"+third_party/skia/include/core/SkRegion.h",
]
...@@ -7,6 +7,7 @@ include_rules = [ ...@@ -7,6 +7,7 @@ include_rules = [
"+content/public/common", "+content/public/common",
"+content/public/test", "+content/public/test",
"+crypto", "+crypto",
"-extensions/components",
"+extensions/test", "+extensions/test",
"+grit/extensions_renderer_resources.h", "+grit/extensions_renderer_resources.h",
"+grit/extensions_resources.h", "+grit/extensions_resources.h",
......
include_rules = [
# Things in extensions/components can depend on extensions, but not other
# extensions/components in a way that could make a cycle in the dependency
# graph. Individual components must explicitly declare their dependencies
# on other components.
"-extensions/components",
]
This directory holds components reused in multiple embedders which themselves
have extensions dependencies. Components such as these do not belong in the root
src/components, because src/extensions already depends on src/components. A
component in src/components can not have an extensions dependency.
Code in an extensions/component should be placed in a namespace corresponding to
the name of the component (ignoring extensions); e.g. for a component living in
extensions/components/foo, code in that component should be in the foo::
namespace.
See src/components/README for additional notes.
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
# This turns on e.g. the filename-based detection of which
# platforms to include source files on (e.g. files ending in
# _mac.h or _mac.cc are only compiled on MacOSX).
'chromium_code': 1,
},
'conditions': [
['toolkit_views==1', {
'includes': [
'native_app_window.gypi',
],
}],
],
}
...@@ -7,15 +7,16 @@ ...@@ -7,15 +7,16 @@
'target_name': 'native_app_window', 'target_name': 'native_app_window',
'type': 'static_library', 'type': 'static_library',
'dependencies': [ 'dependencies': [
'../base/base.gyp:base', '../../base/base.gyp:base',
'../content/content.gyp:content_browser', '../../content/content.gyp:content_browser',
'../extensions/extensions.gyp:extensions_browser', '../../skia/skia.gyp:skia',
'../extensions/extensions.gyp:extensions_common', '../../ui/views/views.gyp:views',
'../skia/skia.gyp:skia', '../../ui/views/controls/webview/webview.gyp:webview',
'../ui/views/views.gyp:views', '../extensions.gyp:extensions_browser',
'../extensions.gyp:extensions_common',
], ],
'include_dirs': [ 'include_dirs': [
'..', '../..',
], ],
'sources': [ 'sources': [
'native_app_window/native_app_window_views.cc', 'native_app_window/native_app_window_views.cc',
......
...@@ -12,6 +12,7 @@ static_library("native_app_window") { ...@@ -12,6 +12,7 @@ static_library("native_app_window") {
"//base", "//base",
"//skia", "//skia",
"//ui/views", "//ui/views",
"//ui/views/controls/webview",
"//content/public/browser", "//content/public/browser",
"//extensions/browser", "//extensions/browser",
"//extensions/common", "//extensions/common",
......
include_rules = [
"+content/public/browser",
"+third_party/skia/include/core/SkRegion.h",
]
benwells@chromium.org
jackhou@chromium.org
jamescook@chromium.org
The native_app_window extensions component contains UI-specific implementations
of extensions::NativeAppWindow.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "components/native_app_window/native_app_window_views.h" #include "extensions/components/native_app_window/native_app_window_views.h"
#include "base/threading/sequenced_worker_pool.h" #include "base/threading/sequenced_worker_pool.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef COMPONENTS_NATIVE_APP_WINDOW_NATIVE_APP_WINDOW_VIEWS_H_ #ifndef EXTENSIONS_COMPONENTS_NATIVE_APP_WINDOW_NATIVE_APP_WINDOW_VIEWS_H_
#define COMPONENTS_NATIVE_APP_WINDOW_NATIVE_APP_WINDOW_VIEWS_H_ #define EXTENSIONS_COMPONENTS_NATIVE_APP_WINDOW_NATIVE_APP_WINDOW_VIEWS_H_
#include "base/observer_list.h" #include "base/observer_list.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
...@@ -194,4 +194,4 @@ class NativeAppWindowViews : public extensions::NativeAppWindow, ...@@ -194,4 +194,4 @@ class NativeAppWindowViews : public extensions::NativeAppWindow,
} // namespace native_app_window } // namespace native_app_window
#endif // COMPONENTS_NATIVE_APP_WINDOW_NATIVE_APP_WINDOW_VIEWS_H_ #endif // EXTENSIONS_COMPONENTS_NATIVE_APP_WINDOW_NATIVE_APP_WINDOW_VIEWS_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment