| OLD | NEW |
| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 last_active ? last_active->profile() : | 135 last_active ? last_active->profile() : |
| 136 ProfileManager::GetDefaultProfileOrOffTheRecord()); | 136 ProfileManager::GetDefaultProfileOrOffTheRecord()); |
| 137 const GURL& url = target_browser->GetSelectedWebContents()->GetURL(); | 137 const GURL& url = target_browser->GetSelectedWebContents() ? |
| 138 target_browser->GetSelectedWebContents()->GetURL() : GURL(); |
| 138 if (url.SchemeIs(chrome::kChromeUIScheme) && | 139 if (url.SchemeIs(chrome::kChromeUIScheme) && |
| 139 url.host() == chrome::kChromeUINewTabHost) { | 140 url.host() == chrome::kChromeUINewTabHost) { |
| 140 // If the NTP is showing, focus the omnibox. | 141 // If the NTP is showing, focus the omnibox. |
| 141 target_browser->window()->SetFocusToLocationBar(true); | 142 target_browser->window()->SetFocusToLocationBar(true); |
| 142 } else { | 143 } else { |
| 143 target_browser->NewTab(); | 144 target_browser->NewTab(); |
| 144 } | 145 } |
| 146 target_browser->window()->Show(); |
| 145 } | 147 } |
| 146 | 148 |
| 147 void ChromeShellDelegate::OpenFileManager() { | 149 void ChromeShellDelegate::OpenFileManager() { |
| 148 #if defined(OS_CHROMEOS) | 150 #if defined(OS_CHROMEOS) |
| 149 file_manager_util::OpenApplication(); | 151 file_manager_util::OpenApplication(); |
| 150 #endif | 152 #endif |
| 151 } | 153 } |
| 152 | 154 |
| 153 void ChromeShellDelegate::OpenCrosh() { | 155 void ChromeShellDelegate::OpenCrosh() { |
| 154 #if defined(OS_CHROMEOS) | 156 #if defined(OS_CHROMEOS) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 ash::Shell::GetInstance()->CreateLauncher(); | 232 ash::Shell::GetInstance()->CreateLauncher(); |
| 231 break; | 233 break; |
| 232 default: | 234 default: |
| 233 NOTREACHED() << "Unexpected notification " << type; | 235 NOTREACHED() << "Unexpected notification " << type; |
| 234 } | 236 } |
| 235 #else | 237 #else |
| 236 // MSVC++ warns about switch statements without any cases. | 238 // MSVC++ warns about switch statements without any cases. |
| 237 NOTREACHED() << "Unexpected notification " << type; | 239 NOTREACHED() << "Unexpected notification " << type; |
| 238 #endif | 240 #endif |
| 239 } | 241 } |
| OLD | NEW |