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/api/tabs/tabs_api.h" | 5 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "apps/shell_window.h" |
11 #include "base/base64.h" | 12 #include "base/base64.h" |
12 #include "base/bind.h" | 13 #include "base/bind.h" |
13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/memory/ref_counted_memory.h" | 16 #include "base/memory/ref_counted_memory.h" |
16 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
17 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
18 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
19 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
20 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
21 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
22 #include "base/strings/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
23 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
24 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 25 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
25 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 26 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
26 #include "chrome/browser/extensions/extension_function_util.h" | 27 #include "chrome/browser/extensions/extension_function_util.h" |
27 #include "chrome/browser/extensions/extension_host.h" | 28 #include "chrome/browser/extensions/extension_host.h" |
28 #include "chrome/browser/extensions/extension_service.h" | 29 #include "chrome/browser/extensions/extension_service.h" |
29 #include "chrome/browser/extensions/extension_tab_util.h" | 30 #include "chrome/browser/extensions/extension_tab_util.h" |
30 #include "chrome/browser/extensions/script_executor.h" | 31 #include "chrome/browser/extensions/script_executor.h" |
31 #include "chrome/browser/extensions/tab_helper.h" | 32 #include "chrome/browser/extensions/tab_helper.h" |
32 #include "chrome/browser/extensions/window_controller.h" | 33 #include "chrome/browser/extensions/window_controller.h" |
33 #include "chrome/browser/extensions/window_controller_list.h" | 34 #include "chrome/browser/extensions/window_controller_list.h" |
34 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 35 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
35 #include "chrome/browser/profiles/profile.h" | 36 #include "chrome/browser/profiles/profile.h" |
36 #include "chrome/browser/translate/translate_tab_helper.h" | 37 #include "chrome/browser/translate/translate_tab_helper.h" |
| 38 #include "chrome/browser/ui/apps/chrome_shell_window_delegate.h" |
37 #include "chrome/browser/ui/browser.h" | 39 #include "chrome/browser/ui/browser.h" |
38 #include "chrome/browser/ui/browser_commands.h" | 40 #include "chrome/browser/ui/browser_commands.h" |
39 #include "chrome/browser/ui/browser_finder.h" | 41 #include "chrome/browser/ui/browser_finder.h" |
40 #include "chrome/browser/ui/browser_iterator.h" | 42 #include "chrome/browser/ui/browser_iterator.h" |
41 #include "chrome/browser/ui/browser_navigator.h" | 43 #include "chrome/browser/ui/browser_navigator.h" |
42 #include "chrome/browser/ui/browser_tabstrip.h" | 44 #include "chrome/browser/ui/browser_tabstrip.h" |
43 #include "chrome/browser/ui/browser_window.h" | 45 #include "chrome/browser/ui/browser_window.h" |
44 #include "chrome/browser/ui/extensions/shell_window.h" | |
45 #include "chrome/browser/ui/host_desktop.h" | 46 #include "chrome/browser/ui/host_desktop.h" |
46 #include "chrome/browser/ui/panels/panel_manager.h" | 47 #include "chrome/browser/ui/panels/panel_manager.h" |
47 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 48 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
48 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 49 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
49 #include "chrome/browser/web_applications/web_app.h" | 50 #include "chrome/browser/web_applications/web_app.h" |
50 #include "chrome/common/chrome_notification_types.h" | 51 #include "chrome/common/chrome_notification_types.h" |
51 #include "chrome/common/chrome_switches.h" | 52 #include "chrome/common/chrome_switches.h" |
52 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" | 53 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" |
53 #include "chrome/common/extensions/api/tabs.h" | 54 #include "chrome/common/extensions/api/tabs.h" |
54 #include "chrome/common/extensions/api/windows.h" | 55 #include "chrome/common/extensions/api/windows.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 #if defined(OS_WIN) | 91 #if defined(OS_WIN) |
91 #include "win8/util/win8_util.h" | 92 #include "win8/util/win8_util.h" |
92 #endif // OS_WIN | 93 #endif // OS_WIN |
93 | 94 |
94 #if defined(USE_ASH) | 95 #if defined(USE_ASH) |
95 #include "ash/ash_switches.h" | 96 #include "ash/ash_switches.h" |
96 #include "chrome/browser/extensions/api/tabs/ash_panel_contents.h" | 97 #include "chrome/browser/extensions/api/tabs/ash_panel_contents.h" |
97 #include "chrome/browser/extensions/shell_window_registry.h" | 98 #include "chrome/browser/extensions/shell_window_registry.h" |
98 #endif | 99 #endif |
99 | 100 |
| 101 using apps::ShellWindow; |
100 using content::BrowserThread; | 102 using content::BrowserThread; |
101 using content::NavigationController; | 103 using content::NavigationController; |
102 using content::NavigationEntry; | 104 using content::NavigationEntry; |
103 using content::OpenURLParams; | 105 using content::OpenURLParams; |
104 using content::Referrer; | 106 using content::Referrer; |
105 using content::RenderViewHost; | 107 using content::RenderViewHost; |
106 using content::WebContents; | 108 using content::WebContents; |
107 | 109 |
108 namespace extensions { | 110 namespace extensions { |
109 | 111 |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 if (create_panel) { | 580 if (create_panel) { |
579 if (urls.empty()) | 581 if (urls.empty()) |
580 urls.push_back(GURL(chrome::kChromeUINewTabURL)); | 582 urls.push_back(GURL(chrome::kChromeUINewTabURL)); |
581 | 583 |
582 #if defined(OS_CHROMEOS) | 584 #if defined(OS_CHROMEOS) |
583 if (PanelManager::ShouldUsePanels(extension_id)) { | 585 if (PanelManager::ShouldUsePanels(extension_id)) { |
584 ShellWindow::CreateParams create_params; | 586 ShellWindow::CreateParams create_params; |
585 create_params.window_type = ShellWindow::WINDOW_TYPE_V1_PANEL; | 587 create_params.window_type = ShellWindow::WINDOW_TYPE_V1_PANEL; |
586 create_params.bounds = window_bounds; | 588 create_params.bounds = window_bounds; |
587 create_params.focused = saw_focus_key && focused; | 589 create_params.focused = saw_focus_key && focused; |
588 ShellWindow* shell_window = | 590 ShellWindow* shell_window = new ShellWindow( |
589 new ShellWindow(window_profile, GetExtension()); | 591 window_profile, new chrome::ChromeShellWindowDelegate(), |
| 592 GetExtension()); |
590 AshPanelContents* ash_panel_contents = new AshPanelContents(shell_window); | 593 AshPanelContents* ash_panel_contents = new AshPanelContents(shell_window); |
591 shell_window->Init(urls[0], ash_panel_contents, create_params); | 594 shell_window->Init(urls[0], ash_panel_contents, create_params); |
592 SetResult(ash_panel_contents->GetExtensionWindowController()-> | 595 SetResult(ash_panel_contents->GetExtensionWindowController()-> |
593 CreateWindowValueWithTabs(GetExtension())); | 596 CreateWindowValueWithTabs(GetExtension())); |
594 // Add the panel to the shell window registry so that it shows up in | 597 // Add the panel to the shell window registry so that it shows up in |
595 // the launcher and as an active render process. | 598 // the launcher and as an active render process. |
596 ShellWindowRegistry::Get(window_profile)->AddShellWindow(shell_window); | 599 ShellWindowRegistry::Get(window_profile)->AddShellWindow(shell_window); |
597 return true; | 600 return true; |
598 } | 601 } |
599 #else | 602 #else |
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 execute_tab_id_ = tab_id; | 2073 execute_tab_id_ = tab_id; |
2071 details_ = details.Pass(); | 2074 details_ = details.Pass(); |
2072 return true; | 2075 return true; |
2073 } | 2076 } |
2074 | 2077 |
2075 bool TabsInsertCSSFunction::ShouldInsertCSS() const { | 2078 bool TabsInsertCSSFunction::ShouldInsertCSS() const { |
2076 return true; | 2079 return true; |
2077 } | 2080 } |
2078 | 2081 |
2079 } // namespace extensions | 2082 } // namespace extensions |
OLD | NEW |