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/ui/ash/chrome_new_window_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.h" |
6 | 6 |
7 #include "ash/keyboard_overlay/keyboard_overlay_view.h" | 7 #include "ash/keyboard_overlay/keyboard_overlay_view.h" |
8 #include "chrome/browser/chromeos/file_manager/app_id.h" | 8 #include "chrome/browser/chromeos/file_manager/app_id.h" |
9 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" | 9 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/extensions/extension_util.h" | 11 #include "chrome/browser/extensions/extension_util.h" |
12 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
| 15 #include "chrome/browser/ui/extensions/app_launch_params.h" |
15 #include "chrome/browser/ui/extensions/application_launch.h" | 16 #include "chrome/browser/ui/extensions/application_launch.h" |
16 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 17 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
17 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" | 18 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" |
18 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
19 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
20 #include "extensions/browser/extension_system.h" | 21 #include "extensions/browser/extension_system.h" |
| 22 #include "extensions/common/constants.h" |
| 23 #include "ui/base/window_open_disposition.h" |
21 | 24 |
22 ChromeNewWindowDelegateChromeos::ChromeNewWindowDelegateChromeos() {} | 25 ChromeNewWindowDelegateChromeos::ChromeNewWindowDelegateChromeos() {} |
23 ChromeNewWindowDelegateChromeos::~ChromeNewWindowDelegateChromeos() {} | 26 ChromeNewWindowDelegateChromeos::~ChromeNewWindowDelegateChromeos() {} |
24 | 27 |
25 void ChromeNewWindowDelegateChromeos::OpenFileManager() { | 28 void ChromeNewWindowDelegateChromeos::OpenFileManager() { |
26 using file_manager::kFileManagerAppId; | 29 using file_manager::kFileManagerAppId; |
27 Profile* const profile = ProfileManager::GetActiveUserProfile(); | 30 Profile* const profile = ProfileManager::GetActiveUserProfile(); |
28 const ExtensionService* const service = | 31 const ExtensionService* const service = |
29 extensions::ExtensionSystem::Get(profile)->extension_service(); | 32 extensions::ExtensionSystem::Get(profile)->extension_service(); |
30 if (!service || | 33 if (!service || |
31 !extensions::util::IsAppLaunchableWithoutEnabling(kFileManagerAppId, | 34 !extensions::util::IsAppLaunchableWithoutEnabling(kFileManagerAppId, |
32 profile)) { | 35 profile)) { |
33 return; | 36 return; |
34 } | 37 } |
35 | 38 |
36 const extensions::Extension* const extension = | 39 const extensions::Extension* const extension = |
37 service->GetInstalledExtension(kFileManagerAppId); | 40 service->GetInstalledExtension(kFileManagerAppId); |
38 // event_flags = 0 means this invokes the same behavior as the launcher | 41 OpenApplication(AppLaunchParams(profile, extension, CURRENT_TAB, |
39 // item is clicked without any keyboard modifiers. | 42 chrome::HOST_DESKTOP_TYPE_ASH, |
40 OpenApplication(AppLaunchParams(profile, | 43 extensions::SOURCE_CHROME_INTERNAL)); |
41 extension, | |
42 0 /* event_flags */, | |
43 chrome::HOST_DESKTOP_TYPE_ASH)); | |
44 } | 44 } |
45 | 45 |
46 void ChromeNewWindowDelegateChromeos::OpenCrosh() { | 46 void ChromeNewWindowDelegateChromeos::OpenCrosh() { |
47 Profile* profile = ProfileManager::GetActiveUserProfile(); | 47 Profile* profile = ProfileManager::GetActiveUserProfile(); |
48 GURL crosh_url = extensions::TerminalExtensionHelper::GetCroshExtensionURL( | 48 GURL crosh_url = extensions::TerminalExtensionHelper::GetCroshExtensionURL( |
49 profile); | 49 profile); |
50 if (!crosh_url.is_valid()) | 50 if (!crosh_url.is_valid()) |
51 return; | 51 return; |
52 chrome::ScopedTabbedBrowserDisplayer displayer( | 52 chrome::ScopedTabbedBrowserDisplayer displayer( |
53 profile, | 53 profile, |
(...skipping 11 matching lines...) Expand all Loading... |
65 } | 65 } |
66 | 66 |
67 void ChromeNewWindowDelegateChromeos::ShowKeyboardOverlay() { | 67 void ChromeNewWindowDelegateChromeos::ShowKeyboardOverlay() { |
68 // TODO(mazda): Move the show logic to ash (http://crbug.com/124222). | 68 // TODO(mazda): Move the show logic to ash (http://crbug.com/124222). |
69 Profile* profile = ProfileManager::GetActiveUserProfile(); | 69 Profile* profile = ProfileManager::GetActiveUserProfile(); |
70 std::string url(chrome::kChromeUIKeyboardOverlayURL); | 70 std::string url(chrome::kChromeUIKeyboardOverlayURL); |
71 ash::KeyboardOverlayView::ShowDialog(profile, | 71 ash::KeyboardOverlayView::ShowDialog(profile, |
72 new ChromeWebContentsHandler, | 72 new ChromeWebContentsHandler, |
73 GURL(url)); | 73 GURL(url)); |
74 } | 74 } |
OLD | NEW |