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" | |
21 | 23 |
22 ChromeNewWindowDelegateChromeos::ChromeNewWindowDelegateChromeos() {} | 24 ChromeNewWindowDelegateChromeos::ChromeNewWindowDelegateChromeos() {} |
23 ChromeNewWindowDelegateChromeos::~ChromeNewWindowDelegateChromeos() {} | 25 ChromeNewWindowDelegateChromeos::~ChromeNewWindowDelegateChromeos() {} |
24 | 26 |
25 void ChromeNewWindowDelegateChromeos::OpenFileManager() { | 27 void ChromeNewWindowDelegateChromeos::OpenFileManager() { |
26 using file_manager::kFileManagerAppId; | 28 using file_manager::kFileManagerAppId; |
27 Profile* const profile = ProfileManager::GetActiveUserProfile(); | 29 Profile* const profile = ProfileManager::GetActiveUserProfile(); |
28 const ExtensionService* const service = | 30 const ExtensionService* const service = |
29 extensions::ExtensionSystem::Get(profile)->extension_service(); | 31 extensions::ExtensionSystem::Get(profile)->extension_service(); |
30 if (!service || | 32 if (!service || |
31 !extensions::util::IsAppLaunchableWithoutEnabling(kFileManagerAppId, | 33 !extensions::util::IsAppLaunchableWithoutEnabling(kFileManagerAppId, |
32 profile)) { | 34 profile)) { |
33 return; | 35 return; |
34 } | 36 } |
35 | 37 |
36 const extensions::Extension* const extension = | 38 const extensions::Extension* const extension = |
37 service->GetInstalledExtension(kFileManagerAppId); | 39 service->GetInstalledExtension(kFileManagerAppId); |
38 // event_flags = 0 means this invokes the same behavior as the launcher | 40 // event_flags = 0 means this invokes the same behavior as the launcher |
39 // item is clicked without any keyboard modifiers. | 41 // item is clicked without any keyboard modifiers. |
40 OpenApplication(AppLaunchParams(profile, | 42 OpenApplication(AppLaunchParams(profile, extension, 0 /* event_flags */, |
sky
2014/11/19 16:52:08
Seems like there should be a constant for 0.
cylee1
2014/11/19 17:51:17
After tracking down the code I feel it's better to
cylee1
2014/11/20 15:16:51
Introduced some bug in patch set 5, fixed in patch
| |
41 extension, | 43 chrome::HOST_DESKTOP_TYPE_ASH, |
42 0 /* event_flags */, | 44 extensions::SOURCE_CHROME_INTERNAL)); |
43 chrome::HOST_DESKTOP_TYPE_ASH)); | |
44 } | 45 } |
45 | 46 |
46 void ChromeNewWindowDelegateChromeos::OpenCrosh() { | 47 void ChromeNewWindowDelegateChromeos::OpenCrosh() { |
47 Profile* profile = ProfileManager::GetActiveUserProfile(); | 48 Profile* profile = ProfileManager::GetActiveUserProfile(); |
48 GURL crosh_url = extensions::TerminalExtensionHelper::GetCroshExtensionURL( | 49 GURL crosh_url = extensions::TerminalExtensionHelper::GetCroshExtensionURL( |
49 profile); | 50 profile); |
50 if (!crosh_url.is_valid()) | 51 if (!crosh_url.is_valid()) |
51 return; | 52 return; |
52 chrome::ScopedTabbedBrowserDisplayer displayer( | 53 chrome::ScopedTabbedBrowserDisplayer displayer( |
53 profile, | 54 profile, |
(...skipping 11 matching lines...) Expand all Loading... | |
65 } | 66 } |
66 | 67 |
67 void ChromeNewWindowDelegateChromeos::ShowKeyboardOverlay() { | 68 void ChromeNewWindowDelegateChromeos::ShowKeyboardOverlay() { |
68 // TODO(mazda): Move the show logic to ash (http://crbug.com/124222). | 69 // TODO(mazda): Move the show logic to ash (http://crbug.com/124222). |
69 Profile* profile = ProfileManager::GetActiveUserProfile(); | 70 Profile* profile = ProfileManager::GetActiveUserProfile(); |
70 std::string url(chrome::kChromeUIKeyboardOverlayURL); | 71 std::string url(chrome::kChromeUIKeyboardOverlayURL); |
71 ash::KeyboardOverlayView::ShowDialog(profile, | 72 ash::KeyboardOverlayView::ShowDialog(profile, |
72 new ChromeWebContentsHandler, | 73 new ChromeWebContentsHandler, |
73 GURL(url)); | 74 GURL(url)); |
74 } | 75 } |
OLD | NEW |