Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: chrome/browser/ui/views/ash/chrome_shell_delegate.cc

Issue 10534053: ash/chromeos: "Search" key to toggle app list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for nit in #2 Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/ui/views/ash/chrome_shell_delegate.h" 5 #include "chrome/browser/ui/views/ash/chrome_shell_delegate.h"
6 6
7 #include "ash/launcher/launcher_types.h" 7 #include "ash/launcher/launcher_types.h"
8 #include "ash/system/tray/system_tray_delegate.h" 8 #include "ash/system/tray/system_tray_delegate.h"
9 #include "ash/wm/partial_screenshot_view.h" 9 #include "ash/wm/partial_screenshot_view.h"
10 #include "ash/wm/window_util.h" 10 #include "ash/wm/window_util.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "chrome/browser/chromeos/login/screen_locker.h" 12 #include "chrome/browser/chromeos/login/screen_locker.h"
13 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" 13 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h"
14 #include "chrome/browser/lifetime/application_lifetime.h" 14 #include "chrome/browser/lifetime/application_lifetime.h"
15 #include "chrome/browser/profiles/profile_manager.h" 15 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/browser/sessions/tab_restore_service.h" 16 #include "chrome/browser/sessions/tab_restore_service.h"
17 #include "chrome/browser/sessions/tab_restore_service_factory.h" 17 #include "chrome/browser/sessions/tab_restore_service_factory.h"
18 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_finder.h" 19 #include "chrome/browser/ui/browser_finder.h"
20 #include "chrome/browser/ui/browser_list.h"
21 #include "chrome/browser/ui/views/ash/app_list/app_list_view_delegate.h" 20 #include "chrome/browser/ui/views/ash/app_list/app_list_view_delegate.h"
22 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h" 21 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h"
23 #include "chrome/browser/ui/views/ash/user_action_handler.h" 22 #include "chrome/browser/ui/views/ash/user_action_handler.h"
24 #include "chrome/browser/ui/views/ash/window_positioner.h" 23 #include "chrome/browser/ui/views/ash/window_positioner.h"
25 #include "chrome/browser/ui/views/frame/browser_view.h" 24 #include "chrome/browser/ui/views/frame/browser_view.h"
26 #include "chrome/common/chrome_notification_types.h" 25 #include "chrome/common/chrome_notification_types.h"
27 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
28 #include "chrome/common/url_constants.h" 27 #include "chrome/common/url_constants.h"
29 #include "content/public/browser/notification_service.h" 28 #include "content/public/browser/notification_service.h"
30 #include "content/public/browser/user_metrics.h" 29 #include "content/public/browser/user_metrics.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 browser->NewTab(); 124 browser->NewTab();
126 browser->window()->Show(); 125 browser->window()->Show();
127 } 126 }
128 127
129 void ChromeShellDelegate::NewWindow(bool is_incognito) { 128 void ChromeShellDelegate::NewWindow(bool is_incognito) {
130 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); 129 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord();
131 Browser::NewEmptyWindow( 130 Browser::NewEmptyWindow(
132 is_incognito ? profile->GetOffTheRecordProfile() : profile); 131 is_incognito ? profile->GetOffTheRecordProfile() : profile);
133 } 132 }
134 133
135 void ChromeShellDelegate::Search() {
136 // Exit fullscreen to show omnibox.
137 Browser* last_active = BrowserList::GetLastActive();
138 if (last_active) {
139 if (last_active->window()->IsFullscreen()) {
140 last_active->ToggleFullscreenMode();
141 // ToggleFullscreenMode is asynchronous, so we don't have omnibox
142 // visible at this point. Wait for next event cycle which toggles
143 // the visibility of omnibox before creating new tab.
144 MessageLoop::current()->PostTask(
145 FROM_HERE, base::Bind(&ChromeShellDelegate::Search,
146 weak_factory_.GetWeakPtr()));
147 return;
148 }
149 }
150
151 Browser* target_browser = browser::FindOrCreateTabbedBrowser(
152 last_active ? last_active->profile() :
153 ProfileManager::GetDefaultProfileOrOffTheRecord());
154 const GURL& url = target_browser->GetSelectedWebContents() ?
155 target_browser->GetSelectedWebContents()->GetURL() : GURL();
156 if (url.SchemeIs(chrome::kChromeUIScheme) &&
157 url.host() == chrome::kChromeUINewTabHost) {
158 // If the NTP is showing, focus the omnibox.
159 target_browser->window()->SetFocusToLocationBar(true);
160 } else {
161 target_browser->NewTab();
162 }
163 target_browser->window()->Show();
164 }
165
166 void ChromeShellDelegate::OpenFileManager() { 134 void ChromeShellDelegate::OpenFileManager() {
167 #if defined(OS_CHROMEOS) 135 #if defined(OS_CHROMEOS)
168 file_manager_util::OpenApplication(); 136 file_manager_util::OpenApplication();
169 #endif 137 #endif
170 } 138 }
171 139
172 void ChromeShellDelegate::OpenCrosh() { 140 void ChromeShellDelegate::OpenCrosh() {
173 #if defined(OS_CHROMEOS) 141 #if defined(OS_CHROMEOS)
174 Browser* browser = browser::FindOrCreateTabbedBrowser( 142 Browser* browser = browser::FindOrCreateTabbedBrowser(
175 ProfileManager::GetDefaultProfileOrOffTheRecord()); 143 ProfileManager::GetDefaultProfileOrOffTheRecord());
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 ash::Shell::GetInstance()->CreateLauncher(); 273 ash::Shell::GetInstance()->CreateLauncher();
306 break; 274 break;
307 default: 275 default:
308 NOTREACHED() << "Unexpected notification " << type; 276 NOTREACHED() << "Unexpected notification " << type;
309 } 277 }
310 #else 278 #else
311 // MSVC++ warns about switch statements without any cases. 279 // MSVC++ warns about switch statements without any cases.
312 NOTREACHED() << "Unexpected notification " << type; 280 NOTREACHED() << "Unexpected notification " << type;
313 #endif 281 #endif
314 } 282 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/ash/chrome_shell_delegate.h ('k') | chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698