| 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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 if (create_panel) { | 579 if (create_panel) { |
| 578 if (urls.empty()) | 580 if (urls.empty()) |
| 579 urls.push_back(GURL(chrome::kChromeUINewTabURL)); | 581 urls.push_back(GURL(chrome::kChromeUINewTabURL)); |
| 580 | 582 |
| 581 #if defined(OS_CHROMEOS) | 583 #if defined(OS_CHROMEOS) |
| 582 if (PanelManager::ShouldUsePanels(extension_id)) { | 584 if (PanelManager::ShouldUsePanels(extension_id)) { |
| 583 ShellWindow::CreateParams create_params; | 585 ShellWindow::CreateParams create_params; |
| 584 create_params.window_type = ShellWindow::WINDOW_TYPE_V1_PANEL; | 586 create_params.window_type = ShellWindow::WINDOW_TYPE_V1_PANEL; |
| 585 create_params.bounds = window_bounds; | 587 create_params.bounds = window_bounds; |
| 586 create_params.focused = saw_focus_key && focused; | 588 create_params.focused = saw_focus_key && focused; |
| 587 ShellWindow* shell_window = | 589 ShellWindow* shell_window = new ShellWindow( |
| 588 new ShellWindow(window_profile, GetExtension()); | 590 window_profile, new chrome::ChromeShellWindowDelegate(), |
| 591 GetExtension()); |
| 589 AshPanelContents* ash_panel_contents = new AshPanelContents(shell_window); | 592 AshPanelContents* ash_panel_contents = new AshPanelContents(shell_window); |
| 590 shell_window->Init(urls[0], ash_panel_contents, create_params); | 593 shell_window->Init(urls[0], ash_panel_contents, create_params); |
| 591 SetResult(ash_panel_contents->GetExtensionWindowController()-> | 594 SetResult(ash_panel_contents->GetExtensionWindowController()-> |
| 592 CreateWindowValueWithTabs(GetExtension())); | 595 CreateWindowValueWithTabs(GetExtension())); |
| 593 // Add the panel to the shell window registry so that it shows up in | 596 // Add the panel to the shell window registry so that it shows up in |
| 594 // the launcher and as an active render process. | 597 // the launcher and as an active render process. |
| 595 ShellWindowRegistry::Get(window_profile)->AddShellWindow(shell_window); | 598 ShellWindowRegistry::Get(window_profile)->AddShellWindow(shell_window); |
| 596 return true; | 599 return true; |
| 597 } | 600 } |
| 598 #else | 601 #else |
| (...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2067 execute_tab_id_ = tab_id; | 2070 execute_tab_id_ = tab_id; |
| 2068 details_ = details.Pass(); | 2071 details_ = details.Pass(); |
| 2069 return true; | 2072 return true; |
| 2070 } | 2073 } |
| 2071 | 2074 |
| 2072 bool TabsInsertCSSFunction::ShouldInsertCSS() const { | 2075 bool TabsInsertCSSFunction::ShouldInsertCSS() const { |
| 2073 return true; | 2076 return true; |
| 2074 } | 2077 } |
| 2075 | 2078 |
| 2076 } // namespace extensions | 2079 } // namespace extensions |
| OLD | NEW |