Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Side by Side Diff: chrome/browser/managed_mode/managed_mode_navigation_observer.cc

Issue 230453004: Remove InfoBarDelegate::web_contents() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 ManagedModeWarningInfoBarDelegate::~ManagedModeWarningInfoBarDelegate() { 115 ManagedModeWarningInfoBarDelegate::~ManagedModeWarningInfoBarDelegate() {
116 } 116 }
117 117
118 bool ManagedModeWarningInfoBarDelegate::ShouldExpire( 118 bool ManagedModeWarningInfoBarDelegate::ShouldExpire(
119 const NavigationDetails& details) const { 119 const NavigationDetails& details) const {
120 // ManagedModeNavigationObserver removes us below. 120 // ManagedModeNavigationObserver removes us below.
121 return false; 121 return false;
122 } 122 }
123 123
124 void ManagedModeWarningInfoBarDelegate::InfoBarDismissed() { 124 void ManagedModeWarningInfoBarDelegate::InfoBarDismissed() {
125 content::WebContents* web_contents =
126 InfoBarService::WebContentsFromInfoBar(infobar());
125 ManagedModeNavigationObserver::FromWebContents( 127 ManagedModeNavigationObserver::FromWebContents(
126 web_contents())->WarnInfoBarDismissed(); 128 web_contents)->WarnInfoBarDismissed();
127 } 129 }
128 130
129 base::string16 ManagedModeWarningInfoBarDelegate::GetMessageText() const { 131 base::string16 ManagedModeWarningInfoBarDelegate::GetMessageText() const {
130 return l10n_util::GetStringUTF16(IDS_MANAGED_USER_WARN_INFOBAR_MESSAGE); 132 return l10n_util::GetStringUTF16(IDS_MANAGED_USER_WARN_INFOBAR_MESSAGE);
131 } 133 }
132 134
133 int ManagedModeWarningInfoBarDelegate::GetButtons() const { 135 int ManagedModeWarningInfoBarDelegate::GetButtons() const {
134 return BUTTON_OK; 136 return BUTTON_OK;
135 } 137 }
136 138
137 base::string16 ManagedModeWarningInfoBarDelegate::GetButtonLabel( 139 base::string16 ManagedModeWarningInfoBarDelegate::GetButtonLabel(
138 InfoBarButton button) const { 140 InfoBarButton button) const {
139 DCHECK_EQ(BUTTON_OK, button); 141 DCHECK_EQ(BUTTON_OK, button);
140 return l10n_util::GetStringUTF16(IDS_MANAGED_USER_WARN_INFOBAR_GO_BACK); 142 return l10n_util::GetStringUTF16(IDS_MANAGED_USER_WARN_INFOBAR_GO_BACK);
141 } 143 }
142 144
143 bool ManagedModeWarningInfoBarDelegate::Accept() { 145 bool ManagedModeWarningInfoBarDelegate::Accept() {
144 #if defined(OS_ANDROID) 146 #if defined(OS_ANDROID)
145 // TODO(bauerb): Get rid of the platform-specific #ifdef here. 147 // TODO(bauerb): Get rid of the platform-specific #ifdef here.
146 // http://crbug.com/313377 148 // http://crbug.com/313377
147 NOTIMPLEMENTED(); 149 NOTIMPLEMENTED();
148 #else 150 #else
149 GoBackToSafety(web_contents()); 151 GoBackToSafety(InfoBarService::WebContentsFromInfoBar(infobar()));
150 #endif 152 #endif
151 153
152 return false; 154 return false;
153 } 155 }
154 156
155 157
156 } // namespace 158 } // namespace
157 159
158 // ManagedModeNavigationObserver ---------------------------------------------- 160 // ManagedModeNavigationObserver ----------------------------------------------
159 161
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 history_service->AddPage(add_page_args); 256 history_service->AddPage(add_page_args);
255 257
256 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); 258 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create());
257 entry->SetVirtualURL(url); 259 entry->SetVirtualURL(url);
258 entry->SetTimestamp(timestamp); 260 entry->SetTimestamp(timestamp);
259 blocked_navigations_.push_back(entry.release()); 261 blocked_navigations_.push_back(entry.release());
260 ManagedUserService* managed_user_service = 262 ManagedUserService* managed_user_service =
261 ManagedUserServiceFactory::GetForProfile(profile); 263 ManagedUserServiceFactory::GetForProfile(profile);
262 managed_user_service->DidBlockNavigation(web_contents()); 264 managed_user_service->DidBlockNavigation(web_contents());
263 } 265 }
OLDNEW
« no previous file with comments | « chrome/browser/infobars/insecure_content_infobar_delegate.cc ('k') | chrome/browser/media/media_stream_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698