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

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

Issue 10206033: ash/chromeos: Search key opens new tab in last active browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // visible at this point. Wait for next event cycle which toggles 125 // visible at this point. Wait for next event cycle which toggles
126 // the visibility of omnibox before creating new tab. 126 // the visibility of omnibox before creating new tab.
127 MessageLoop::current()->PostTask( 127 MessageLoop::current()->PostTask(
128 FROM_HERE, base::Bind(&ChromeShellDelegate::Search, 128 FROM_HERE, base::Bind(&ChromeShellDelegate::Search,
129 weak_factory_.GetWeakPtr())); 129 weak_factory_.GetWeakPtr()));
130 return; 130 return;
131 } 131 }
132 } 132 }
133 133
134 Browser* target_browser = Browser::GetOrCreateTabbedBrowser( 134 Browser* target_browser = Browser::GetOrCreateTabbedBrowser(
135 ProfileManager::GetDefaultProfileOrOffTheRecord()); 135 last_active ? last_active->profile() :
136 ProfileManager::GetDefaultProfileOrOffTheRecord());
136 const GURL& url = target_browser->GetSelectedWebContents()->GetURL(); 137 const GURL& url = target_browser->GetSelectedWebContents()->GetURL();
137 if (url.SchemeIs(chrome::kChromeUIScheme) && 138 if (url.SchemeIs(chrome::kChromeUIScheme) &&
138 url.host() == chrome::kChromeUINewTabHost) { 139 url.host() == chrome::kChromeUINewTabHost) {
139 // If the NTP is showing, focus the omnibox. 140 // If the NTP is showing, focus the omnibox.
140 target_browser->window()->SetFocusToLocationBar(true); 141 target_browser->window()->SetFocusToLocationBar(true);
141 } else { 142 } else {
142 target_browser->NewTab(); 143 target_browser->NewTab();
143 } 144 }
144 } 145 }
145 146
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 ash::Shell::GetInstance()->CreateLauncher(); 230 ash::Shell::GetInstance()->CreateLauncher();
230 break; 231 break;
231 default: 232 default:
232 NOTREACHED() << "Unexpected notification " << type; 233 NOTREACHED() << "Unexpected notification " << type;
233 } 234 }
234 #else 235 #else
235 // MSVC++ warns about switch statements without any cases. 236 // MSVC++ warns about switch statements without any cases.
236 NOTREACHED() << "Unexpected notification " << type; 237 NOTREACHED() << "Unexpected notification " << type;
237 #endif 238 #endif
238 } 239 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698