OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extension_tab_util.h" | 5 #include "chrome/browser/extensions/extension_tab_util.h" |
6 | 6 |
7 #include "apps/app_window.h" | |
8 #include "apps/app_window_registry.h" | |
9 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
11 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
12 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
13 #include "chrome/browser/extensions/tab_helper.h" | 11 #include "chrome/browser/extensions/tab_helper.h" |
14 #include "chrome/browser/extensions/window_controller.h" | 12 #include "chrome/browser/extensions/window_controller.h" |
15 #include "chrome/browser/extensions/window_controller_list.h" | 13 #include "chrome/browser/extensions/window_controller_list.h" |
16 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/sessions/session_tab_helper.h" | 15 #include "chrome/browser/sessions/session_tab_helper.h" |
18 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_finder.h" | 17 #include "chrome/browser/ui/browser_finder.h" |
20 #include "chrome/browser/ui/browser_iterator.h" | 18 #include "chrome/browser/ui/browser_iterator.h" |
21 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
22 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 20 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
23 #include "chrome/browser/ui/singleton_tabs.h" | 21 #include "chrome/browser/ui/singleton_tabs.h" |
24 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 22 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
25 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
26 #include "chrome/common/extensions/api/tabs.h" | 24 #include "chrome/common/extensions/api/tabs.h" |
27 #include "chrome/common/extensions/manifest_url_handler.h" | 25 #include "chrome/common/extensions/manifest_url_handler.h" |
28 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
29 #include "components/url_fixer/url_fixer.h" | 27 #include "components/url_fixer/url_fixer.h" |
30 #include "content/public/browser/favicon_status.h" | 28 #include "content/public/browser/favicon_status.h" |
31 #include "content/public/browser/navigation_entry.h" | 29 #include "content/public/browser/navigation_entry.h" |
32 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
| 31 #include "extensions/browser/app_window/app_window.h" |
| 32 #include "extensions/browser/app_window/app_window_registry.h" |
33 #include "extensions/common/constants.h" | 33 #include "extensions/common/constants.h" |
34 #include "extensions/common/error_utils.h" | 34 #include "extensions/common/error_utils.h" |
35 #include "extensions/common/extension.h" | 35 #include "extensions/common/extension.h" |
36 #include "extensions/common/feature_switch.h" | 36 #include "extensions/common/feature_switch.h" |
37 #include "extensions/common/manifest_constants.h" | 37 #include "extensions/common/manifest_constants.h" |
38 #include "extensions/common/manifest_handlers/incognito_info.h" | 38 #include "extensions/common/manifest_handlers/incognito_info.h" |
39 #include "extensions/common/permissions/api_permission.h" | 39 #include "extensions/common/permissions/api_permission.h" |
40 #include "extensions/common/permissions/permissions_data.h" | 40 #include "extensions/common/permissions/permissions_data.h" |
41 #include "url/gurl.h" | 41 #include "url/gurl.h" |
42 | 42 |
43 using apps::AppWindow; | |
44 using content::NavigationEntry; | 43 using content::NavigationEntry; |
45 using content::WebContents; | 44 using content::WebContents; |
46 | 45 |
47 namespace extensions { | 46 namespace extensions { |
48 | 47 |
49 namespace { | 48 namespace { |
50 | 49 |
51 namespace keys = tabs_constants; | 50 namespace keys = tabs_constants; |
52 | 51 |
53 WindowController* GetAppWindowController(const WebContents* contents) { | 52 WindowController* GetAppWindowController(const WebContents* contents) { |
54 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 53 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
55 apps::AppWindowRegistry* registry = apps::AppWindowRegistry::Get(profile); | 54 AppWindowRegistry* registry = AppWindowRegistry::Get(profile); |
56 if (!registry) | 55 if (!registry) |
57 return NULL; | 56 return NULL; |
58 AppWindow* app_window = | 57 AppWindow* app_window = |
59 registry->GetAppWindowForRenderViewHost(contents->GetRenderViewHost()); | 58 registry->GetAppWindowForRenderViewHost(contents->GetRenderViewHost()); |
60 if (!app_window) | 59 if (!app_window) |
61 return NULL; | 60 return NULL; |
62 return WindowControllerList::GetInstance()->FindWindowById( | 61 return WindowControllerList::GetInstance()->FindWindowById( |
63 app_window->session_id().id()); | 62 app_window->session_id().id()); |
64 } | 63 } |
65 | 64 |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 false); | 591 false); |
593 browser->OpenURL(params); | 592 browser->OpenURL(params); |
594 browser->window()->Show(); | 593 browser->window()->Show(); |
595 WebContents* web_contents = | 594 WebContents* web_contents = |
596 browser->tab_strip_model()->GetActiveWebContents(); | 595 browser->tab_strip_model()->GetActiveWebContents(); |
597 web_contents->GetDelegate()->ActivateContents(web_contents); | 596 web_contents->GetDelegate()->ActivateContents(web_contents); |
598 } | 597 } |
599 } | 598 } |
600 | 599 |
601 } // namespace extensions | 600 } // namespace extensions |
OLD | NEW |