Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import "chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.h" | 5 #import "chrome/browser/ui/cocoa/browser/exclusive_access_controller_views.h" |
| 6 | 6 |
| 7 #include "chrome/browser/download/download_shelf.h" | 7 #include "chrome/browser/download/download_shelf.h" |
| 8 #include "chrome/browser/fullscreen.h" | 8 #include "chrome/browser/fullscreen.h" |
| 9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
| 10 #include "chrome/browser/ui/cocoa/accelerators_cocoa.h" | 10 #include "chrome/browser/ui/cocoa/accelerators_cocoa.h" |
| 11 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 11 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 12 #import "chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.h" | 12 #import "chrome/browser/ui/cocoa/exclusive_access_bubble_window_controller.h" |
| 13 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" | 13 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" |
| 14 #include "chrome/browser/ui/status_bubble.h" | 14 #include "chrome/browser/ui/status_bubble.h" |
| 15 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" | 15 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" |
| 16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 17 #include "components/prefs/pref_service.h" | 17 #include "components/prefs/pref_service.h" |
| 18 #import "ui/gfx/mac/coordinate_conversion.h" | 18 #import "ui/gfx/mac/coordinate_conversion.h" |
| 19 | 19 |
| 20 ExclusiveAccessController::ExclusiveAccessController( | 20 ExclusiveAccessController::ExclusiveAccessController( |
| 21 BrowserWindowController* controller, | 21 BrowserWindowController* controller, |
| 22 Browser* browser) | 22 Browser* browser) |
| 23 : controller_(controller), | 23 : controller_(controller), |
| 24 browser_(browser), | 24 browser_(browser), |
| 25 bubble_type_(EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE) {} | 25 bubble_type_(EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE) { |
| 26 pref_registrar_.Init(GetProfile()->GetPrefs()); | |
| 27 pref_registrar_.Add( | |
| 28 prefs::kShowFullscreenToolbar, | |
| 29 base::Bind(&ExclusiveAccessController::UpdateFullscreenToolbar, | |
| 30 base::Unretained(this))); | |
| 31 } | |
| 26 | 32 |
| 27 ExclusiveAccessController::~ExclusiveAccessController() {} | 33 ExclusiveAccessController::~ExclusiveAccessController() {} |
| 28 | 34 |
| 29 void ExclusiveAccessController::Show() { | 35 void ExclusiveAccessController::Show() { |
| 30 if (ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { | 36 if (ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { |
| 31 views_bubble_.reset( | 37 views_bubble_.reset( |
| 32 new ExclusiveAccessBubbleViews(this, url_, bubble_type_)); | 38 new ExclusiveAccessBubbleViews(this, url_, bubble_type_)); |
| 33 return; | 39 return; |
| 34 } | 40 } |
| 35 | 41 |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 66 } | 72 } |
| 67 | 73 |
| 68 bool ExclusiveAccessController::SupportsFullscreenWithToolbar() const { | 74 bool ExclusiveAccessController::SupportsFullscreenWithToolbar() const { |
| 69 return chrome::mac::SupportsSystemFullscreen(); | 75 return chrome::mac::SupportsSystemFullscreen(); |
| 70 } | 76 } |
| 71 | 77 |
| 72 void ExclusiveAccessController::UpdateFullscreenWithToolbar(bool with_toolbar) { | 78 void ExclusiveAccessController::UpdateFullscreenWithToolbar(bool with_toolbar) { |
| 73 [controller_ updateFullscreenWithToolbar:with_toolbar]; | 79 [controller_ updateFullscreenWithToolbar:with_toolbar]; |
| 74 } | 80 } |
| 75 | 81 |
| 76 void ExclusiveAccessController::ToggleFullscreenToolbar() { | 82 void ExclusiveAccessController::UpdateFullscreenToolbar() { |
| 77 PrefService* prefs = browser_->profile()->GetPrefs(); | 83 PrefService* prefs = GetProfile()->GetPrefs(); |
| 78 bool hideToolbar = !prefs->GetBoolean(prefs::kHideFullscreenToolbar); | 84 bool hideToolbar = !prefs->GetBoolean(prefs::kShowFullscreenToolbar); |
|
msw
2016/03/01 00:07:15
This inversion seems correct, but the old logic al
spqchan
2016/03/01 17:50:18
Sorry for the confusion, the old logic was differe
| |
| 79 [controller_ setFullscreenToolbarHidden:hideToolbar]; | 85 [controller_ setFullscreenToolbarHidden:hideToolbar]; |
| 80 prefs->SetBoolean(prefs::kHideFullscreenToolbar, hideToolbar); | |
| 81 } | 86 } |
| 82 | 87 |
| 83 bool ExclusiveAccessController::IsFullscreenWithToolbar() const { | 88 bool ExclusiveAccessController::IsFullscreenWithToolbar() const { |
| 84 return IsFullscreen() && ![controller_ inPresentationMode]; | 89 return IsFullscreen() && ![controller_ inPresentationMode]; |
| 85 } | 90 } |
| 86 | 91 |
| 87 // See the Fullscreen terminology section and the (Fullscreen) interface | 92 // See the Fullscreen terminology section and the (Fullscreen) interface |
| 88 // category in browser_window_controller.h for a detailed explanation of the | 93 // category in browser_window_controller.h for a detailed explanation of the |
| 89 // logic in this method. | 94 // logic in this method. |
| 90 void ExclusiveAccessController::EnterFullscreen( | 95 void ExclusiveAccessController::EnterFullscreen( |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 } | 181 } |
| 177 | 182 |
| 178 gfx::Rect ExclusiveAccessController::GetTopContainerBoundsInScreen() { | 183 gfx::Rect ExclusiveAccessController::GetTopContainerBoundsInScreen() { |
| 179 NOTREACHED(); // Only used for ImmersiveMode. | 184 NOTREACHED(); // Only used for ImmersiveMode. |
| 180 return gfx::Rect(); | 185 return gfx::Rect(); |
| 181 } | 186 } |
| 182 | 187 |
| 183 BrowserWindow* ExclusiveAccessController::GetBrowserWindow() const { | 188 BrowserWindow* ExclusiveAccessController::GetBrowserWindow() const { |
| 184 return [controller_ browserWindow]; | 189 return [controller_ browserWindow]; |
| 185 } | 190 } |
| OLD | NEW |