OLD | NEW |
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/managed_mode/managed_mode_navigation_observer.h" | 5 #include "chrome/browser/managed_mode/managed_mode_navigation_observer.h" |
6 | 6 |
7 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 7 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
8 #include "chrome/browser/infobars/infobar_tab_helper.h" | 8 #include "chrome/browser/infobars/infobar_tab_helper.h" |
9 #include "chrome/browser/managed_mode/managed_mode.h" | 9 #include "chrome/browser/managed_mode/managed_mode.h" |
10 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" | 10 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 &web_contents->GetController(); | 50 &web_contents->GetController(); |
51 if (controller->CanGoBack()) { | 51 if (controller->CanGoBack()) { |
52 controller->GoBack(); | 52 controller->GoBack(); |
53 return; | 53 return; |
54 } | 54 } |
55 | 55 |
56 // If we can't go back (because we opened a new tab), try to close the tab. | 56 // If we can't go back (because we opened a new tab), try to close the tab. |
57 // If this is the last tab, open a new window. | 57 // If this is the last tab, open a new window. |
58 if (BrowserList::size() == 1) { | 58 if (BrowserList::size() == 1) { |
59 Browser* browser = *(BrowserList::begin()); | 59 Browser* browser = *(BrowserList::begin()); |
60 DCHECK(browser == browser::FindBrowserWithWebContents(web_contents)); | 60 DCHECK(browser == chrome::FindBrowserWithWebContents(web_contents)); |
61 if (browser->tab_count() == 1) | 61 if (browser->tab_count() == 1) |
62 chrome::NewEmptyWindow(browser->profile()); | 62 chrome::NewEmptyWindow(browser->profile()); |
63 } | 63 } |
64 | 64 |
65 web_contents->GetDelegate()->CloseContents(web_contents); | 65 web_contents->GetDelegate()->CloseContents(web_contents); |
66 } | 66 } |
67 | 67 |
68 ManagedModeWarningInfobarDelegate::ManagedModeWarningInfobarDelegate( | 68 ManagedModeWarningInfobarDelegate::ManagedModeWarningInfobarDelegate( |
69 InfoBarTabHelper* infobar_tab_helper) | 69 InfoBarTabHelper* infobar_tab_helper) |
70 : ConfirmInfoBarDelegate(infobar_tab_helper) {} | 70 : ConfirmInfoBarDelegate(infobar_tab_helper) {} |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } else { | 148 } else { |
149 if (warn_infobar_delegate_) { | 149 if (warn_infobar_delegate_) { |
150 InfoBarTabHelper* infobar_tab_helper = | 150 InfoBarTabHelper* infobar_tab_helper = |
151 InfoBarTabHelper::FromWebContents(web_contents()); | 151 InfoBarTabHelper::FromWebContents(web_contents()); |
152 infobar_tab_helper->RemoveInfoBar(warn_infobar_delegate_); | 152 infobar_tab_helper->RemoveInfoBar(warn_infobar_delegate_); |
153 warn_infobar_delegate_= NULL; | 153 warn_infobar_delegate_= NULL; |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 } | 157 } |
OLD | NEW |