OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/chrome_extensions_browser_client.h" | 5 #include "chrome/browser/extensions/chrome_extensions_browser_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/version.h" | 8 #include "base/version.h" |
9 #include "chrome/browser/app_mode/app_mode_utils.h" | 9 #include "chrome/browser/app_mode/app_mode_utils.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/extensions/chrome_url_request_util.h" | 23 #include "chrome/browser/extensions/chrome_url_request_util.h" |
24 #include "chrome/browser/extensions/error_console/error_console.h" | 24 #include "chrome/browser/extensions/error_console/error_console.h" |
25 #include "chrome/browser/extensions/event_router_forwarder.h" | 25 #include "chrome/browser/extensions/event_router_forwarder.h" |
26 #include "chrome/browser/extensions/extension_system_factory.h" | 26 #include "chrome/browser/extensions/extension_system_factory.h" |
27 #include "chrome/browser/extensions/extension_util.h" | 27 #include "chrome/browser/extensions/extension_util.h" |
28 #include "chrome/browser/extensions/menu_manager.h" | 28 #include "chrome/browser/extensions/menu_manager.h" |
29 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 29 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
30 #include "chrome/browser/net/chrome_net_log.h" | 30 #include "chrome/browser/net/chrome_net_log.h" |
31 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
32 #include "chrome/browser/profiles/profile_manager.h" | 32 #include "chrome/browser/profiles/profile_manager.h" |
| 33 #include "chrome/browser/task_management/web_contents_tags.h" |
33 #include "chrome/common/channel_info.h" | 34 #include "chrome/common/channel_info.h" |
34 #include "chrome/common/chrome_paths.h" | 35 #include "chrome/common/chrome_paths.h" |
35 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
36 #include "chrome/common/extensions/features/feature_channel.h" | 37 #include "chrome/common/extensions/features/feature_channel.h" |
37 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
38 #include "components/version_info/version_info.h" | 39 #include "components/version_info/version_info.h" |
39 #include "content/public/browser/render_process_host.h" | 40 #include "content/public/browser/render_process_host.h" |
40 #include "extensions/browser/api/generated_api_registration.h" | 41 #include "extensions/browser/api/generated_api_registration.h" |
41 #include "extensions/browser/extension_function_registry.h" | 42 #include "extensions/browser/extension_function_registry.h" |
42 #include "extensions/browser/extension_prefs.h" | 43 #include "extensions/browser/extension_prefs.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 content::BrowserContext* browser_context, | 331 content::BrowserContext* browser_context, |
331 int embedder_process_id, | 332 int embedder_process_id, |
332 int view_instance_id) { | 333 int view_instance_id) { |
333 // Clean up context menus for the WebView. | 334 // Clean up context menus for the WebView. |
334 auto menu_manager = | 335 auto menu_manager = |
335 MenuManager::Get(Profile::FromBrowserContext(browser_context)); | 336 MenuManager::Get(Profile::FromBrowserContext(browser_context)); |
336 menu_manager->RemoveAllContextItems( | 337 menu_manager->RemoveAllContextItems( |
337 MenuItem::ExtensionKey("", embedder_process_id, view_instance_id)); | 338 MenuItem::ExtensionKey("", embedder_process_id, view_instance_id)); |
338 } | 339 } |
339 | 340 |
| 341 void ChromeExtensionsBrowserClient::AttachExtensionTaskManagerTag( |
| 342 content::WebContents* web_contents, |
| 343 ViewType view_type) { |
| 344 switch (view_type) { |
| 345 case VIEW_TYPE_APP_WINDOW: |
| 346 case VIEW_TYPE_EXTENSION_BACKGROUND_PAGE: |
| 347 case VIEW_TYPE_EXTENSION_DIALOG: |
| 348 case VIEW_TYPE_EXTENSION_POPUP: |
| 349 case VIEW_TYPE_LAUNCHER_PAGE: |
| 350 case VIEW_TYPE_VIRTUAL_KEYBOARD: |
| 351 // These are the only types that are tracked by the ExtensionTag. |
| 352 task_management::WebContentsTags::CreateForExtension(web_contents, |
| 353 view_type); |
| 354 return; |
| 355 |
| 356 case VIEW_TYPE_BACKGROUND_CONTENTS: |
| 357 case VIEW_TYPE_PANEL: |
| 358 case VIEW_TYPE_TAB_CONTENTS: |
| 359 // Those types are tracked by other tags: |
| 360 // BACKGROUND_CONTENTS --> task_management::BackgroundContentsTag. |
| 361 // PANEL --> task_management::PanelTag. |
| 362 // TAB_CONTENTS --> task_management::TabContentsTag. |
| 363 // These tags are created and attached to the web_contents in other |
| 364 // locations, and they must be ignored here. |
| 365 return; |
| 366 |
| 367 case VIEW_TYPE_INVALID: |
| 368 NOTREACHED(); |
| 369 return; |
| 370 } |
| 371 } |
| 372 |
340 } // namespace extensions | 373 } // namespace extensions |
OLD | NEW |