| 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" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 pref_registrar_.Add( | 29 pref_registrar_.Add( |
| 30 prefs::kShowFullscreenToolbar, | 30 prefs::kShowFullscreenToolbar, |
| 31 base::Bind(&ExclusiveAccessController::UpdateFullscreenToolbar, | 31 base::Bind(&ExclusiveAccessController::UpdateFullscreenToolbar, |
| 32 base::Unretained(this))); | 32 base::Unretained(this))); |
| 33 } | 33 } |
| 34 | 34 |
| 35 ExclusiveAccessController::~ExclusiveAccessController() {} | 35 ExclusiveAccessController::~ExclusiveAccessController() {} |
| 36 | 36 |
| 37 void ExclusiveAccessController::Show() { | 37 void ExclusiveAccessController::Show() { |
| 38 if (ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { | 38 if (ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled()) { |
| 39 // Hide the backspace shortcut bubble, to avoid overlapping. |
| 40 new_back_shortcut_bubble_.reset(); |
| 41 |
| 39 views_bubble_.reset( | 42 views_bubble_.reset( |
| 40 new ExclusiveAccessBubbleViews(this, url_, bubble_type_)); | 43 new ExclusiveAccessBubbleViews(this, url_, bubble_type_)); |
| 41 return; | 44 return; |
| 42 } | 45 } |
| 43 | 46 |
| 44 [cocoa_bubble_ closeImmediately]; | 47 [cocoa_bubble_ closeImmediately]; |
| 45 cocoa_bubble_.reset([[ExclusiveAccessBubbleWindowController alloc] | 48 cocoa_bubble_.reset([[ExclusiveAccessBubbleWindowController alloc] |
| 46 initWithOwner:controller_ | 49 initWithOwner:controller_ |
| 47 exclusive_access_manager:browser_->exclusive_access_manager() | 50 exclusive_access_manager:browser_->exclusive_access_manager() |
| 48 profile:browser_->profile() | 51 profile:browser_->profile() |
| 49 url:url_ | 52 url:url_ |
| 50 bubbleType:bubble_type_]); | 53 bubbleType:bubble_type_]); |
| 51 [cocoa_bubble_ showWindow]; | 54 [cocoa_bubble_ showWindow]; |
| 52 } | 55 } |
| 53 | 56 |
| 54 void ExclusiveAccessController::ShowNewBackShortcutBubble(bool forward) { | 57 void ExclusiveAccessController::ShowNewBackShortcutBubble(bool forward) { |
| 58 // Hide the exclusive access bubble, to avoid overlapping. |
| 59 views_bubble_.reset(); |
| 60 |
| 55 if (new_back_shortcut_bubble_) | 61 if (new_back_shortcut_bubble_) |
| 56 new_back_shortcut_bubble_->UpdateContent(forward); | 62 new_back_shortcut_bubble_->UpdateContent(forward); |
| 57 else | 63 else |
| 58 new_back_shortcut_bubble_.reset(new NewBackShortcutBubble(this, forward)); | 64 new_back_shortcut_bubble_.reset(new NewBackShortcutBubble(this, forward)); |
| 59 } | 65 } |
| 60 | 66 |
| 61 void ExclusiveAccessController::Destroy() { | 67 void ExclusiveAccessController::Destroy() { |
| 62 views_bubble_.reset(); | 68 views_bubble_.reset(); |
| 63 [cocoa_bubble_ closeImmediately]; | 69 [cocoa_bubble_ closeImmediately]; |
| 64 cocoa_bubble_.reset(); | 70 cocoa_bubble_.reset(); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 } | 197 } |
| 192 | 198 |
| 193 gfx::Rect ExclusiveAccessController::GetTopContainerBoundsInScreen() { | 199 gfx::Rect ExclusiveAccessController::GetTopContainerBoundsInScreen() { |
| 194 NOTREACHED(); // Only used for ImmersiveMode. | 200 NOTREACHED(); // Only used for ImmersiveMode. |
| 195 return gfx::Rect(); | 201 return gfx::Rect(); |
| 196 } | 202 } |
| 197 | 203 |
| 198 BrowserWindow* ExclusiveAccessController::GetBrowserWindow() const { | 204 BrowserWindow* ExclusiveAccessController::GetBrowserWindow() const { |
| 199 return [controller_ browserWindow]; | 205 return [controller_ browserWindow]; |
| 200 } | 206 } |
| OLD | NEW |