OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/exclusive_access/exclusive_access_controller_base.h" | 5 #include "chrome/browser/ui/exclusive_access/exclusive_access_controller_base.h" |
6 | 6 |
7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
11 #include "content/public/browser/navigation_details.h" | 11 #include "content/public/browser/navigation_details.h" |
12 #include "content/public/browser/navigation_entry.h" | 12 #include "content/public/browser/navigation_entry.h" |
13 #include "content/public/browser/notification_service.h" | 13 #include "content/public/browser/notification_service.h" |
14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
15 | 15 |
16 using content::WebContents; | 16 using content::WebContents; |
17 | 17 |
18 ExclusiveAccessControllerBase::ExclusiveAccessControllerBase( | 18 ExclusiveAccessControllerBase::ExclusiveAccessControllerBase( |
19 ExclusiveAccessManager* manager, | 19 ExclusiveAccessManager* manager) |
20 Browser* browser) | 20 : manager_(manager), tab_with_exclusive_access_(nullptr) { |
21 : manager_(manager), | |
22 browser_(browser), | |
23 profile_(browser->profile()), | |
24 tab_with_exclusive_access_(nullptr) { | |
25 DCHECK(profile_); | |
26 } | 21 } |
27 | 22 |
28 ExclusiveAccessControllerBase::~ExclusiveAccessControllerBase() { | 23 ExclusiveAccessControllerBase::~ExclusiveAccessControllerBase() { |
29 } | 24 } |
30 | 25 |
31 GURL ExclusiveAccessControllerBase::GetExclusiveAccessBubbleURL() const { | 26 GURL ExclusiveAccessControllerBase::GetExclusiveAccessBubbleURL() const { |
32 return manager_->GetExclusiveAccessBubbleURL(); | 27 return manager_->GetExclusiveAccessBubbleURL(); |
33 } | 28 } |
34 | 29 |
35 GURL ExclusiveAccessControllerBase::GetURLForExclusiveAccessBubble() const { | 30 GURL ExclusiveAccessControllerBase::GetURLForExclusiveAccessBubble() const { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 79 |
85 void ExclusiveAccessControllerBase::UpdateNotificationRegistrations() { | 80 void ExclusiveAccessControllerBase::UpdateNotificationRegistrations() { |
86 if (tab_with_exclusive_access_ && registrar_.IsEmpty()) { | 81 if (tab_with_exclusive_access_ && registrar_.IsEmpty()) { |
87 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 82 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
88 content::Source<content::NavigationController>( | 83 content::Source<content::NavigationController>( |
89 &tab_with_exclusive_access_->GetController())); | 84 &tab_with_exclusive_access_->GetController())); |
90 } else if (!tab_with_exclusive_access_ && !registrar_.IsEmpty()) { | 85 } else if (!tab_with_exclusive_access_ && !registrar_.IsEmpty()) { |
91 registrar_.RemoveAll(); | 86 registrar_.RemoveAll(); |
92 } | 87 } |
93 } | 88 } |
OLD | NEW |