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

Side by Side Diff: chrome/browser/ui/browser_command_controller.cc

Issue 1581473002: Remove base/win/metro.{cc|h} and some associated code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 4 years, 11 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
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/browser_command_controller.h" 5 #include "chrome/browser/ui/browser_command_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "content/public/browser/web_contents_observer.h" 51 #include "content/public/browser/web_contents_observer.h"
52 #include "content/public/common/url_constants.h" 52 #include "content/public/common/url_constants.h"
53 #include "extensions/browser/extension_system.h" 53 #include "extensions/browser/extension_system.h"
54 #include "ui/events/keycodes/keyboard_codes.h" 54 #include "ui/events/keycodes/keyboard_codes.h"
55 55
56 #if defined(OS_MACOSX) 56 #if defined(OS_MACOSX)
57 #include "chrome/browser/ui/browser_commands_mac.h" 57 #include "chrome/browser/ui/browser_commands_mac.h"
58 #endif 58 #endif
59 59
60 #if defined(OS_WIN) 60 #if defined(OS_WIN)
61 #include "base/win/metro.h"
62 #include "base/win/windows_version.h" 61 #include "base/win/windows_version.h"
63 #include "chrome/browser/ui/apps/apps_metro_handler_win.h"
64 #include "content/public/browser/gpu_data_manager.h" 62 #include "content/public/browser/gpu_data_manager.h"
65 #endif 63 #endif
66 64
67 #if defined(USE_ASH) 65 #if defined(USE_ASH)
68 #include "ash/accelerators/accelerator_commands.h" 66 #include "ash/accelerators/accelerator_commands.h"
69 #include "chrome/browser/ui/ash/ash_util.h" 67 #include "chrome/browser/ui/ash/ash_util.h"
70 #endif 68 #endif
71 69
72 #if defined(OS_CHROMEOS) 70 #if defined(OS_CHROMEOS)
73 #include "ash/multi_profile_uma.h" 71 #include "ash/multi_profile_uma.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return true; 109 return true;
112 110
113 // If the |virtual_url()| isn't a chrome:// URL, check if it's actually 111 // If the |virtual_url()| isn't a chrome:// URL, check if it's actually
114 // view-source: of a chrome:// URL. 112 // view-source: of a chrome:// URL.
115 if (entry->GetVirtualURL().SchemeIs(content::kViewSourceScheme)) 113 if (entry->GetVirtualURL().SchemeIs(content::kViewSourceScheme))
116 return entry->GetURL().SchemeIs(content::kChromeUIScheme); 114 return entry->GetURL().SchemeIs(content::kChromeUIScheme);
117 115
118 return false; 116 return false;
119 } 117 }
120 118
121 #if defined(OS_WIN)
122 // Windows 8 specific helper class to manage DefaultBrowserWorker. It does the
123 // following asynchronous actions in order:
124 // 1- Check that chrome is the default browser
125 // 2- If we are the default, restart chrome in metro and exit
126 // 3- If not the default browser show the 'select default browser' system dialog
127 // 4- When dialog dismisses check again who got made the default
128 // 5- If we are the default then restart chrome in metro and exit
129 // 6- If we are not the default exit.
130 //
131 // Note: this class deletes itself.
132 class SwitchToMetroUIHandler
133 : public ShellIntegration::DefaultWebClientObserver {
134 public:
135 SwitchToMetroUIHandler()
136 : default_browser_worker_(
137 new ShellIntegration::DefaultBrowserWorker(this)),
138 first_check_(true) {
139 default_browser_worker_->StartCheckIsDefault();
140 }
141
142 ~SwitchToMetroUIHandler() override {
143 default_browser_worker_->ObserverDestroyed();
144 }
145
146 private:
147 void SetDefaultWebClientUIState(
148 ShellIntegration::DefaultWebClientUIState state) override {
149 switch (state) {
150 case ShellIntegration::STATE_PROCESSING:
151 return;
152 case ShellIntegration::STATE_UNKNOWN :
153 break;
154 case ShellIntegration::STATE_IS_DEFAULT:
155 chrome::AttemptRestartToMetroMode();
156 break;
157 case ShellIntegration::STATE_NOT_DEFAULT:
158 if (first_check_) {
159 default_browser_worker_->StartSetAsDefault();
160 return;
161 }
162 break;
163 default:
164 NOTREACHED();
165 }
166 delete this;
167 }
168
169 void OnSetAsDefaultConcluded(bool success) override {
170 if (!success) {
171 delete this;
172 return;
173 }
174 first_check_ = false;
175 }
176
177 bool IsInteractiveSetDefaultPermitted() override {
178 return true;
179 }
180
181 scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_;
182 bool first_check_;
183
184 DISALLOW_COPY_AND_ASSIGN(SwitchToMetroUIHandler);
185 };
186 #endif // defined(OS_WIN)
187
188 } // namespace 119 } // namespace
189 120
190 namespace chrome { 121 namespace chrome {
191 122
192 /////////////////////////////////////////////////////////////////////////////// 123 ///////////////////////////////////////////////////////////////////////////////
193 // BrowserCommandController, public: 124 // BrowserCommandController, public:
194 125
195 BrowserCommandController::BrowserCommandController(Browser* browser) 126 BrowserCommandController::BrowserCommandController(Browser* browser)
196 : browser_(browser), 127 : browser_(browser),
197 command_updater_(this), 128 command_updater_(this),
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 #endif 423 #endif
493 424
494 #if defined(OS_WIN) 425 #if defined(OS_WIN)
495 // Windows 8 specific commands. 426 // Windows 8 specific commands.
496 case IDC_METRO_SNAP_ENABLE: 427 case IDC_METRO_SNAP_ENABLE:
497 browser_->SetMetroSnapMode(true); 428 browser_->SetMetroSnapMode(true);
498 break; 429 break;
499 case IDC_METRO_SNAP_DISABLE: 430 case IDC_METRO_SNAP_DISABLE:
500 browser_->SetMetroSnapMode(false); 431 browser_->SetMetroSnapMode(false);
501 break; 432 break;
433 // TODO(scottmg): Remove entirely http://crbug.com/558054.
502 case IDC_WIN_DESKTOP_RESTART: 434 case IDC_WIN_DESKTOP_RESTART:
503 if (!VerifyASHSwitchForApps(window()->GetNativeWindow(), id))
504 break;
505
506 chrome::AttemptRestartToDesktopMode();
507 if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
508 content::RecordAction(base::UserMetricsAction("Win8DesktopRestart"));
509 } else {
510 content::RecordAction(base::UserMetricsAction("Win7DesktopRestart"));
511 }
512 break; 435 break;
436 // TODO(scottmg): Remove entirely http://crbug.com/558054.
513 case IDC_WIN8_METRO_RESTART: 437 case IDC_WIN8_METRO_RESTART:
514 case IDC_WIN_CHROMEOS_RESTART: 438 case IDC_WIN_CHROMEOS_RESTART:
515 if (!VerifyASHSwitchForApps(window()->GetNativeWindow(), id))
516 break;
517 if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
518 // SwitchToMetroUIHandler deletes itself.
519 new SwitchToMetroUIHandler;
520 content::RecordAction(base::UserMetricsAction("Win8MetroRestart"));
521 } else {
522 content::RecordAction(base::UserMetricsAction("Win7ASHRestart"));
523 chrome::AttemptRestartToMetroMode();
524 }
525 break;
526 case IDC_PIN_TO_START_SCREEN:
527 TogglePagePinnedToStartScreen(browser_);
528 break; 439 break;
529 #endif 440 #endif
530 441
531 #if defined(OS_MACOSX) 442 #if defined(OS_MACOSX)
532 case IDC_PRESENTATION_MODE: 443 case IDC_PRESENTATION_MODE:
533 chrome::ToggleFullscreenMode(browser_); 444 chrome::ToggleFullscreenMode(browser_);
534 break; 445 break;
535 case IDC_TOGGLE_FULLSCREEN_TOOLBAR: 446 case IDC_TOGGLE_FULLSCREEN_TOOLBAR:
536 chrome::ToggleFullscreenToolbar(browser_); 447 chrome::ToggleFullscreenToolbar(browser_);
537 break; 448 break;
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 1295
1385 BrowserWindow* BrowserCommandController::window() { 1296 BrowserWindow* BrowserCommandController::window() {
1386 return browser_->window(); 1297 return browser_->window();
1387 } 1298 }
1388 1299
1389 Profile* BrowserCommandController::profile() { 1300 Profile* BrowserCommandController::profile() {
1390 return browser_->profile(); 1301 return browser_->profile();
1391 } 1302 }
1392 1303
1393 } // namespace chrome 1304 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698