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/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 #endif // OS_WIN | 192 #endif // OS_WIN |
193 | 193 |
194 #if defined(OS_MACOSX) | 194 #if defined(OS_MACOSX) |
195 #include "content/browser/find_pasteboard.h" | 195 #include "content/browser/find_pasteboard.h" |
196 #endif | 196 #endif |
197 | 197 |
198 #if defined(OS_CHROMEOS) | 198 #if defined(OS_CHROMEOS) |
199 #include "chrome/browser/chromeos/boot_times_loader.h" | 199 #include "chrome/browser/chromeos/boot_times_loader.h" |
200 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | 200 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
201 #include "chrome/browser/chromeos/dbus/power_manager_client.h" | 201 #include "chrome/browser/chromeos/dbus/power_manager_client.h" |
| 202 #if defined(USE_AURA) |
| 203 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" |
| 204 #endif |
202 #include "chrome/browser/ui/webui/active_downloads_ui.h" | 205 #include "chrome/browser/ui/webui/active_downloads_ui.h" |
203 #endif | 206 #endif |
204 | 207 |
205 #if defined(USE_AURA) | 208 #if defined(USE_AURA) |
206 #include "ash/shell.h" | 209 #include "ash/shell.h" |
207 #endif | 210 #endif |
208 | 211 |
209 #if !defined(OS_CHROMEOS) || defined(USE_AURA) | 212 #if !defined(OS_CHROMEOS) || defined(USE_AURA) |
210 #include "chrome/browser/download/download_shelf.h" | 213 #include "chrome/browser/download/download_shelf.h" |
211 #endif | 214 #endif |
(...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2372 window_->ShowMobileSetup(); | 2375 window_->ShowMobileSetup(); |
2373 } else { | 2376 } else { |
2374 OpenURL(OpenURLParams( | 2377 OpenURL(OpenURLParams( |
2375 GURL(chrome::kChromeUIMobileSetupURL), Referrer(), NEW_FOREGROUND_TAB, | 2378 GURL(chrome::kChromeUIMobileSetupURL), Referrer(), NEW_FOREGROUND_TAB, |
2376 content::PAGE_TRANSITION_LINK, false)); | 2379 content::PAGE_TRANSITION_LINK, false)); |
2377 window_->Activate(); | 2380 window_->Activate(); |
2378 } | 2381 } |
2379 } | 2382 } |
2380 #endif | 2383 #endif |
2381 | 2384 |
| 2385 #if defined(OS_CHROMEOS) && defined(USE_AURA) |
| 2386 void Browser::OpenCrosh() { |
| 2387 GURL crosh_url = TerminalExtensionHelper::GetCroshExtensionURL(profile_); |
| 2388 if (!crosh_url.is_valid()) |
| 2389 return; |
| 2390 OpenURL(OpenURLParams(crosh_url, Referrer(), NEW_FOREGROUND_TAB, |
| 2391 content::PAGE_TRANSITION_GENERATED, |
| 2392 false)); |
| 2393 } |
| 2394 #endif |
| 2395 |
2382 void Browser::OpenPluginsTabAndActivate() { | 2396 void Browser::OpenPluginsTabAndActivate() { |
2383 OpenURL(OpenURLParams( | 2397 OpenURL(OpenURLParams( |
2384 GURL(chrome::kChromeUIPluginsURL), Referrer(), NEW_FOREGROUND_TAB, | 2398 GURL(chrome::kChromeUIPluginsURL), Referrer(), NEW_FOREGROUND_TAB, |
2385 content::PAGE_TRANSITION_LINK, false)); | 2399 content::PAGE_TRANSITION_LINK, false)); |
2386 window_->Activate(); | 2400 window_->Activate(); |
2387 } | 2401 } |
2388 | 2402 |
2389 /////////////////////////////////////////////////////////////////////////////// | 2403 /////////////////////////////////////////////////////////////////////////////// |
2390 | 2404 |
2391 // static | 2405 // static |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2973 case IDC_VIEW_INCOMPATIBILITIES: ShowAboutConflictsTab(); break; | 2987 case IDC_VIEW_INCOMPATIBILITIES: ShowAboutConflictsTab(); break; |
2974 case IDC_HELP_PAGE: ShowHelpTab(); break; | 2988 case IDC_HELP_PAGE: ShowHelpTab(); break; |
2975 #if defined(OS_CHROMEOS) | 2989 #if defined(OS_CHROMEOS) |
2976 case IDC_LOCK_SCREEN: LockScreen(); break; | 2990 case IDC_LOCK_SCREEN: LockScreen(); break; |
2977 case IDC_SHUTDOWN: Shutdown(); break; | 2991 case IDC_SHUTDOWN: Shutdown(); break; |
2978 case IDC_FILE_MANAGER: OpenFileManager(); break; | 2992 case IDC_FILE_MANAGER: OpenFileManager(); break; |
2979 case IDC_SYSTEM_OPTIONS: OpenSystemOptionsDialog(); break; | 2993 case IDC_SYSTEM_OPTIONS: OpenSystemOptionsDialog(); break; |
2980 case IDC_INTERNET_OPTIONS: OpenInternetOptionsDialog(); break; | 2994 case IDC_INTERNET_OPTIONS: OpenInternetOptionsDialog(); break; |
2981 case IDC_LANGUAGE_OPTIONS: OpenLanguageOptionsDialog(); break; | 2995 case IDC_LANGUAGE_OPTIONS: OpenLanguageOptionsDialog(); break; |
2982 #endif | 2996 #endif |
| 2997 #if defined(OS_CHROMEOS) && defined(USE_AURA) |
| 2998 case IDC_NEW_CROSH_TAB: OpenCrosh(); break; |
| 2999 #endif |
2983 case IDC_SHOW_SYNC_SETUP: ShowSyncSetup(); break; | 3000 case IDC_SHOW_SYNC_SETUP: ShowSyncSetup(); break; |
2984 case IDC_TOGGLE_SPEECH_INPUT: ToggleSpeechInput(); break; | 3001 case IDC_TOGGLE_SPEECH_INPUT: ToggleSpeechInput(); break; |
2985 | 3002 |
2986 default: | 3003 default: |
2987 LOG(WARNING) << "Received Unimplemented Command: " << id; | 3004 LOG(WARNING) << "Received Unimplemented Command: " << id; |
2988 break; | 3005 break; |
2989 } | 3006 } |
2990 } | 3007 } |
2991 | 3008 |
2992 void Browser::ExecuteCommand(int id, int event_flags) { | 3009 void Browser::ExecuteCommand(int id, int event_flags) { |
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4464 // (like Back & Forward with initial page load) must have their state | 4481 // (like Back & Forward with initial page load) must have their state |
4465 // initialized here, otherwise they will be forever disabled. | 4482 // initialized here, otherwise they will be forever disabled. |
4466 | 4483 |
4467 // Navigation commands | 4484 // Navigation commands |
4468 command_updater_.UpdateCommandEnabled(IDC_RELOAD, true); | 4485 command_updater_.UpdateCommandEnabled(IDC_RELOAD, true); |
4469 command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE, true); | 4486 command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE, true); |
4470 | 4487 |
4471 // Window management commands | 4488 // Window management commands |
4472 command_updater_.UpdateCommandEnabled(IDC_CLOSE_WINDOW, true); | 4489 command_updater_.UpdateCommandEnabled(IDC_CLOSE_WINDOW, true); |
4473 command_updater_.UpdateCommandEnabled(IDC_NEW_TAB, true); | 4490 command_updater_.UpdateCommandEnabled(IDC_NEW_TAB, true); |
| 4491 #if defined(OS_CHROMEOS) && defined(USE_AURA) |
| 4492 command_updater_.UpdateCommandEnabled(IDC_NEW_CROSH_TAB, true); |
| 4493 #endif |
4474 command_updater_.UpdateCommandEnabled(IDC_CLOSE_TAB, true); | 4494 command_updater_.UpdateCommandEnabled(IDC_CLOSE_TAB, true); |
4475 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, true); | 4495 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, true); |
4476 command_updater_.UpdateCommandEnabled(IDC_RESTORE_TAB, false); | 4496 command_updater_.UpdateCommandEnabled(IDC_RESTORE_TAB, false); |
4477 command_updater_.UpdateCommandEnabled(IDC_EXIT, true); | 4497 command_updater_.UpdateCommandEnabled(IDC_EXIT, true); |
4478 command_updater_.UpdateCommandEnabled(IDC_DEBUG_FRAME_TOGGLE, true); | 4498 command_updater_.UpdateCommandEnabled(IDC_DEBUG_FRAME_TOGGLE, true); |
4479 | 4499 |
4480 // Page-related commands | 4500 // Page-related commands |
4481 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, true); | 4501 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, true); |
4482 command_updater_.UpdateCommandEnabled(IDC_ENCODING_AUTO_DETECT, true); | 4502 command_updater_.UpdateCommandEnabled(IDC_ENCODING_AUTO_DETECT, true); |
4483 command_updater_.UpdateCommandEnabled(IDC_ENCODING_UTF8, true); | 4503 command_updater_.UpdateCommandEnabled(IDC_ENCODING_UTF8, true); |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5487 local_state->SetBoolean(prefs::kShouldShowFirstRunBubble, false); | 5507 local_state->SetBoolean(prefs::kShouldShowFirstRunBubble, false); |
5488 window_->GetLocationBar()->ShowFirstRunBubble(); | 5508 window_->GetLocationBar()->ShowFirstRunBubble(); |
5489 } else { | 5509 } else { |
5490 GlobalErrorService* service = | 5510 GlobalErrorService* service = |
5491 GlobalErrorServiceFactory::GetForProfile(profile()); | 5511 GlobalErrorServiceFactory::GetForProfile(profile()); |
5492 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 5512 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
5493 if (error) | 5513 if (error) |
5494 error->ShowBubbleView(this); | 5514 error->ShowBubbleView(this); |
5495 } | 5515 } |
5496 } | 5516 } |
OLD | NEW |