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/content/keyboard_overlay/keyboard_overlay_view.h" | 7 #include "ash/content/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" |
(...skipping 22 matching lines...) Expand all Loading... |
33 extensions::ExtensionSystem::Get(profile)->extension_service(); | 33 extensions::ExtensionSystem::Get(profile)->extension_service(); |
34 if (!service || | 34 if (!service || |
35 !extensions::util::IsAppLaunchableWithoutEnabling(kFileManagerAppId, | 35 !extensions::util::IsAppLaunchableWithoutEnabling(kFileManagerAppId, |
36 profile)) { | 36 profile)) { |
37 return; | 37 return; |
38 } | 38 } |
39 | 39 |
40 const extensions::Extension* const extension = | 40 const extensions::Extension* const extension = |
41 service->GetInstalledExtension(kFileManagerAppId); | 41 service->GetInstalledExtension(kFileManagerAppId); |
42 OpenApplication(AppLaunchParams(profile, extension, CURRENT_TAB, | 42 OpenApplication(AppLaunchParams(profile, extension, CURRENT_TAB, |
43 chrome::HOST_DESKTOP_TYPE_ASH, | |
44 extensions::SOURCE_KEYBOARD)); | 43 extensions::SOURCE_KEYBOARD)); |
45 } | 44 } |
46 | 45 |
47 void ChromeNewWindowDelegateChromeos::OpenGetHelp() { | 46 void ChromeNewWindowDelegateChromeos::OpenGetHelp() { |
48 Profile* const profile = ProfileManager::GetActiveUserProfile(); | 47 Profile* const profile = ProfileManager::GetActiveUserProfile(); |
49 chrome::ShowHelpForProfile( | 48 chrome::ShowHelpForProfile(profile, chrome::HELP_SOURCE_KEYBOARD); |
50 profile, chrome::HOST_DESKTOP_TYPE_ASH, chrome::HELP_SOURCE_KEYBOARD); | |
51 } | 49 } |
52 | 50 |
53 void ChromeNewWindowDelegateChromeos::OpenCrosh() { | 51 void ChromeNewWindowDelegateChromeos::OpenCrosh() { |
54 Profile* profile = ProfileManager::GetActiveUserProfile(); | 52 Profile* profile = ProfileManager::GetActiveUserProfile(); |
55 GURL crosh_url = extensions::TerminalExtensionHelper::GetCroshExtensionURL( | 53 GURL crosh_url = extensions::TerminalExtensionHelper::GetCroshExtensionURL( |
56 profile); | 54 profile); |
57 if (!crosh_url.is_valid()) | 55 if (!crosh_url.is_valid()) |
58 return; | 56 return; |
59 chrome::ScopedTabbedBrowserDisplayer displayer(profile); | 57 chrome::ScopedTabbedBrowserDisplayer displayer(profile); |
60 Browser* browser = displayer.browser(); | 58 Browser* browser = displayer.browser(); |
61 content::WebContents* page = browser->OpenURL( | 59 content::WebContents* page = browser->OpenURL( |
62 content::OpenURLParams(crosh_url, | 60 content::OpenURLParams(crosh_url, |
63 content::Referrer(), | 61 content::Referrer(), |
64 NEW_FOREGROUND_TAB, | 62 NEW_FOREGROUND_TAB, |
65 ui::PAGE_TRANSITION_GENERATED, | 63 ui::PAGE_TRANSITION_GENERATED, |
66 false)); | 64 false)); |
67 browser->window()->Show(); | 65 browser->window()->Show(); |
68 browser->window()->Activate(); | 66 browser->window()->Activate(); |
69 page->Focus(); | 67 page->Focus(); |
70 } | 68 } |
71 | 69 |
72 void ChromeNewWindowDelegateChromeos::ShowKeyboardOverlay() { | 70 void ChromeNewWindowDelegateChromeos::ShowKeyboardOverlay() { |
73 // TODO(mazda): Move the show logic to ash (http://crbug.com/124222). | 71 // TODO(mazda): Move the show logic to ash (http://crbug.com/124222). |
74 Profile* profile = ProfileManager::GetActiveUserProfile(); | 72 Profile* profile = ProfileManager::GetActiveUserProfile(); |
75 std::string url(chrome::kChromeUIKeyboardOverlayURL); | 73 std::string url(chrome::kChromeUIKeyboardOverlayURL); |
76 ash::KeyboardOverlayView::ShowDialog(profile, | 74 ash::KeyboardOverlayView::ShowDialog(profile, |
77 new ChromeWebContentsHandler, | 75 new ChromeWebContentsHandler, |
78 GURL(url)); | 76 GURL(url)); |
79 } | 77 } |
OLD | NEW |