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/browser/ui/views/new_back_shortcut_bubble.h" |
16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
17 #include "components/prefs/pref_service.h" | 18 #include "components/prefs/pref_service.h" |
18 #include "ui/base/cocoa/cocoa_base_utils.h" | 19 #include "ui/base/cocoa/cocoa_base_utils.h" |
19 #import "ui/gfx/mac/coordinate_conversion.h" | 20 #import "ui/gfx/mac/coordinate_conversion.h" |
20 | 21 |
21 ExclusiveAccessController::ExclusiveAccessController( | 22 ExclusiveAccessController::ExclusiveAccessController( |
22 BrowserWindowController* controller, | 23 BrowserWindowController* controller, |
23 Browser* browser) | 24 Browser* browser) |
24 : controller_(controller), | 25 : controller_(controller), |
25 browser_(browser), | 26 browser_(browser), |
(...skipping 17 matching lines...) Expand all Loading... |
43 [cocoa_bubble_ closeImmediately]; | 44 [cocoa_bubble_ closeImmediately]; |
44 cocoa_bubble_.reset([[ExclusiveAccessBubbleWindowController alloc] | 45 cocoa_bubble_.reset([[ExclusiveAccessBubbleWindowController alloc] |
45 initWithOwner:controller_ | 46 initWithOwner:controller_ |
46 exclusive_access_manager:browser_->exclusive_access_manager() | 47 exclusive_access_manager:browser_->exclusive_access_manager() |
47 profile:browser_->profile() | 48 profile:browser_->profile() |
48 url:url_ | 49 url:url_ |
49 bubbleType:bubble_type_]); | 50 bubbleType:bubble_type_]); |
50 [cocoa_bubble_ showWindow]; | 51 [cocoa_bubble_ showWindow]; |
51 } | 52 } |
52 | 53 |
| 54 void ExclusiveAccessController::ShowNewBackShortcutBubble(bool forward) { |
| 55 if (new_back_shortcut_bubble_) |
| 56 new_back_shortcut_bubble_->UpdateContent(forward); |
| 57 else |
| 58 new_back_shortcut_bubble_.reset(new NewBackShortcutBubble(this, forward)); |
| 59 } |
| 60 |
53 void ExclusiveAccessController::Destroy() { | 61 void ExclusiveAccessController::Destroy() { |
54 views_bubble_.reset(); | 62 views_bubble_.reset(); |
55 [cocoa_bubble_ closeImmediately]; | 63 [cocoa_bubble_ closeImmediately]; |
56 cocoa_bubble_.reset(); | 64 cocoa_bubble_.reset(); |
57 url_ = GURL(); | 65 url_ = GURL(); |
58 bubble_type_ = EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE; | 66 bubble_type_ = EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE; |
59 } | 67 } |
60 | 68 |
61 void ExclusiveAccessController::Layout(CGFloat max_y) { | 69 void ExclusiveAccessController::Layout(CGFloat max_y) { |
62 if (views_bubble_) | 70 if (views_bubble_) |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 } | 191 } |
184 | 192 |
185 gfx::Rect ExclusiveAccessController::GetTopContainerBoundsInScreen() { | 193 gfx::Rect ExclusiveAccessController::GetTopContainerBoundsInScreen() { |
186 NOTREACHED(); // Only used for ImmersiveMode. | 194 NOTREACHED(); // Only used for ImmersiveMode. |
187 return gfx::Rect(); | 195 return gfx::Rect(); |
188 } | 196 } |
189 | 197 |
190 BrowserWindow* ExclusiveAccessController::GetBrowserWindow() const { | 198 BrowserWindow* ExclusiveAccessController::GetBrowserWindow() const { |
191 return [controller_ browserWindow]; | 199 return [controller_ browserWindow]; |
192 } | 200 } |
OLD | NEW |