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

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

Issue 11299035: Support manual (white|black)list, previewing and allowing after interstitial (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor changes Created 7 years, 11 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"
8 #include "base/i18n/rtl.h"
9 #include "base/string_number_conversions.h"
7 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" 10 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h"
8 #include "chrome/browser/api/infobars/infobar_service.h" 11 #include "chrome/browser/api/infobars/infobar_service.h"
12 #include "chrome/browser/api/infobars/simple_alert_infobar_delegate.h"
9 #include "chrome/browser/managed_mode/managed_mode.h" 13 #include "chrome/browser/managed_mode/managed_mode.h"
14 #include "chrome/browser/managed_mode/managed_mode_interstitial.h"
15 #include "chrome/browser/managed_mode/managed_mode_resource_throttle.h"
10 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" 16 #include "chrome/browser/managed_mode/managed_mode_url_filter.h"
17 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/browser_commands.h" 20 #include "chrome/browser/ui/browser_commands.h"
13 #include "chrome/browser/ui/browser_finder.h" 21 #include "chrome/browser/ui/browser_finder.h"
14 #include "chrome/browser/ui/browser_list.h" 22 #include "chrome/browser/ui/browser_list.h"
23 #include "chrome/common/jstemplate_builder.h"
24 #include "chrome/common/pref_names.h"
15 #include "chrome/common/url_constants.h" 25 #include "chrome/common/url_constants.h"
26 #include "content/public/browser/browser_thread.h"
27 #include "content/public/browser/render_process_host.h"
28 #include "content/public/browser/render_view_host.h"
16 #include "content/public/browser/web_contents_delegate.h" 29 #include "content/public/browser/web_contents_delegate.h"
17 #include "content/public/common/frame_navigate_params.h" 30 #include "content/public/common/frame_navigate_params.h"
18 #include "grit/generated_resources.h" 31 #include "grit/generated_resources.h"
32 #include "grit/locale_settings.h"
19 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
20 34
35 using content::BrowserThread;
36
21 namespace { 37 namespace {
22 38
23 class ManagedModeWarningInfobarDelegate : public ConfirmInfoBarDelegate { 39 class ManagedModeWarningInfobarDelegate : public ConfirmInfoBarDelegate {
24 public: 40 public:
25 // Creates a managed mode warning delegate and adds it to |infobar_service|. 41 // Creates a managed mode warning delegate and adds it to |infobar_service|.
26 // Returns the delegate if it was successfully added. 42 // Returns the delegate if it was successfully added.
27 static InfoBarDelegate* Create(InfoBarService* infobar_service); 43 static InfoBarDelegate* Create(InfoBarService* infobar_service,
44 int last_allowed_page);
28 45
29 private: 46 private:
30 explicit ManagedModeWarningInfobarDelegate(InfoBarService* infobar_service); 47 explicit ManagedModeWarningInfobarDelegate(InfoBarService* infobar_service,
48 int last_allowed_page);
31 virtual ~ManagedModeWarningInfobarDelegate(); 49 virtual ~ManagedModeWarningInfobarDelegate();
32 50
33 // ConfirmInfoBarDelegate overrides: 51 // ConfirmInfoBarDelegate overrides:
34 virtual string16 GetMessageText() const OVERRIDE; 52 virtual string16 GetMessageText() const OVERRIDE;
35 virtual int GetButtons() const OVERRIDE; 53 virtual int GetButtons() const OVERRIDE;
36 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; 54 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
37 virtual bool Accept() OVERRIDE; 55 virtual bool Accept() OVERRIDE;
38 virtual bool Cancel() OVERRIDE; 56 virtual bool Cancel() OVERRIDE;
39 57
40 // InfoBarDelegate override: 58 // InfoBarDelegate override:
41 virtual bool ShouldExpire( 59 virtual bool ShouldExpire(
42 const content::LoadCommittedDetails& details) const OVERRIDE; 60 const content::LoadCommittedDetails& details) const OVERRIDE;
43 virtual void InfoBarDismissed() OVERRIDE; 61 virtual void InfoBarDismissed() OVERRIDE;
44 62
63 int last_allowed_page_;
64
45 DISALLOW_COPY_AND_ASSIGN(ManagedModeWarningInfobarDelegate); 65 DISALLOW_COPY_AND_ASSIGN(ManagedModeWarningInfobarDelegate);
46 }; 66 };
47 67
48 void GoBackToSafety(content::WebContents* web_contents) { 68 void GoBackToSafety(content::WebContents* web_contents) {
49 // For now, just go back one page (the user didn't retreat from that page, 69 // For now, just go back one page (the user didn't retreat from that page,
50 // so it should be okay). 70 // so it should be okay).
51 content::NavigationController* controller = 71 content::NavigationController* controller =
52 &web_contents->GetController(); 72 &web_contents->GetController();
53 if (controller->CanGoBack()) { 73 if (controller->CanGoBack()) {
54 controller->GoBack(); 74 controller->GoBack();
55 return; 75 return;
56 } 76 }
57 77
58 // If we can't go back (because we opened a new tab), try to close the tab. 78 // If we can't go back (because we opened a new tab), try to close the tab.
59 // If this is the last tab, open a new window. 79 // If this is the last tab, open a new window.
60 if (BrowserList::size() == 1) { 80 if (BrowserList::size() == 1) {
61 Browser* browser = *(BrowserList::begin()); 81 Browser* browser = *(BrowserList::begin());
62 DCHECK(browser == chrome::FindBrowserWithWebContents(web_contents)); 82 DCHECK(browser == chrome::FindBrowserWithWebContents(web_contents));
63 if (browser->tab_count() == 1) 83 if (browser->tab_count() == 1)
64 chrome::NewEmptyWindow(browser->profile()); 84 chrome::NewEmptyWindow(browser->profile());
65 } 85 }
66 86
67 web_contents->GetDelegate()->CloseContents(web_contents); 87 web_contents->GetDelegate()->CloseContents(web_contents);
68 } 88 }
69 89
70 // static 90 // static
71 InfoBarDelegate* ManagedModeWarningInfobarDelegate::Create( 91 InfoBarDelegate* ManagedModeWarningInfobarDelegate::Create(
72 InfoBarService* infobar_service) { 92 InfoBarService* infobar_service, int last_allowed_page) {
73 return infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( 93 scoped_ptr<InfoBarDelegate> delegate(
74 new ManagedModeWarningInfobarDelegate(infobar_service))); 94 new ManagedModeWarningInfobarDelegate(infobar_service, last_allowed_page));
95 return infobar_service->AddInfoBar(delegate.Pass());
75 } 96 }
76 97
77 ManagedModeWarningInfobarDelegate::ManagedModeWarningInfobarDelegate( 98 ManagedModeWarningInfobarDelegate::ManagedModeWarningInfobarDelegate(
78 InfoBarService* infobar_service) 99 InfoBarService* infobar_service,
79 : ConfirmInfoBarDelegate(infobar_service) {} 100 int last_allowed_page)
101 : ConfirmInfoBarDelegate(infobar_service),
102 last_allowed_page_(last_allowed_page) {}
80 103
81 ManagedModeWarningInfobarDelegate::~ManagedModeWarningInfobarDelegate() {} 104 ManagedModeWarningInfobarDelegate::~ManagedModeWarningInfobarDelegate() {}
82 105
83 string16 ManagedModeWarningInfobarDelegate::GetMessageText() const { 106 string16 ManagedModeWarningInfobarDelegate::GetMessageText() const {
84 return l10n_util::GetStringUTF16(IDS_MANAGED_MODE_WARNING_MESSAGE); 107 return l10n_util::GetStringUTF16(IDS_MANAGED_MODE_WARNING_MESSAGE);
85 } 108 }
86 109
87 int ManagedModeWarningInfobarDelegate::GetButtons() const { 110 int ManagedModeWarningInfobarDelegate::GetButtons() const {
88 return BUTTON_OK; 111 return BUTTON_OK;
89 } 112 }
(...skipping 20 matching lines...) Expand all
110 // ManagedModeNavigationObserver removes us below. 133 // ManagedModeNavigationObserver removes us below.
111 return false; 134 return false;
112 } 135 }
113 136
114 void ManagedModeWarningInfobarDelegate::InfoBarDismissed() { 137 void ManagedModeWarningInfobarDelegate::InfoBarDismissed() {
115 ManagedModeNavigationObserver* observer = 138 ManagedModeNavigationObserver* observer =
116 ManagedModeNavigationObserver::FromWebContents(owner()->GetWebContents()); 139 ManagedModeNavigationObserver::FromWebContents(owner()->GetWebContents());
117 observer->WarnInfobarDismissed(); 140 observer->WarnInfobarDismissed();
118 } 141 }
119 142
143 class ManagedModePreviewInfobarDelegate : public ConfirmInfoBarDelegate {
144 public:
145 // Creates a managed mode preview delegate and adds it to |infobar_service|.
146 // Returns the delegate if it was successfully added.
147 static InfoBarDelegate* Create(InfoBarService* infobar_service);
148
149 private:
150 explicit ManagedModePreviewInfobarDelegate(InfoBarService* infobar_service);
151 virtual ~ManagedModePreviewInfobarDelegate();
152
153 // ConfirmInfoBarDelegate overrides:
154 virtual string16 GetMessageText() const OVERRIDE;
155 virtual int GetButtons() const OVERRIDE;
156 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
157 virtual bool Accept() OVERRIDE;
158 virtual bool Cancel() OVERRIDE;
159
160 // InfoBarDelegate override:
161 virtual bool ShouldExpire(
162 const content::LoadCommittedDetails& details) const OVERRIDE;
163 virtual void InfoBarDismissed() OVERRIDE;
164
165 DISALLOW_COPY_AND_ASSIGN(ManagedModePreviewInfobarDelegate);
166 };
167
168 // static
169 InfoBarDelegate* ManagedModePreviewInfobarDelegate::Create(
170 InfoBarService* infobar_service) {
171 scoped_ptr<InfoBarDelegate> delegate(
172 new ManagedModePreviewInfobarDelegate(infobar_service));
173 return infobar_service->AddInfoBar(delegate.Pass());
174 }
175
176 ManagedModePreviewInfobarDelegate::ManagedModePreviewInfobarDelegate(
177 InfoBarService* infobar_service)
178 : ConfirmInfoBarDelegate(infobar_service) {}
179
180 ManagedModePreviewInfobarDelegate::~ManagedModePreviewInfobarDelegate() {}
181
182 string16 ManagedModePreviewInfobarDelegate::GetMessageText() const {
183 return l10n_util::GetStringUTF16(IDS_MANAGED_MODE_PREVIEW_MESSAGE);
184 }
185
186 int ManagedModePreviewInfobarDelegate::GetButtons() const {
187 return BUTTON_OK | BUTTON_CANCEL;
188 }
189
190 string16 ManagedModePreviewInfobarDelegate::GetButtonLabel(
191 InfoBarButton button) const {
192 return l10n_util::GetStringUTF16(
193 (button == BUTTON_OK) ? IDS_MANAGED_MODE_PREVIEW_ACCEPT
194 : IDS_MANAGED_MODE_GO_BACK_ACTION);
195 }
196
197 bool ManagedModePreviewInfobarDelegate::Accept() {
198 ManagedModeNavigationObserver* observer =
199 ManagedModeNavigationObserver::FromWebContents(
200 owner()->GetWebContents());
201 observer->AddSavedURLsToWhitelistAndClearState();
202 return true;
203 }
204
205 bool ManagedModePreviewInfobarDelegate::Cancel() {
206 GoBackToSafety(owner()->GetWebContents());
207 return false;
208 }
209
210 bool ManagedModePreviewInfobarDelegate::ShouldExpire(
211 const content::LoadCommittedDetails& details) const {
212 // ManagedModeNavigationObserver removes us below.
213 return false;
214 }
215
216 void ManagedModePreviewInfobarDelegate::InfoBarDismissed() {
217 ManagedModeNavigationObserver* observer =
218 ManagedModeNavigationObserver::FromWebContents(
219 owner()->GetWebContents());
220 observer->PreviewInfobarDismissed();
221 }
222
120 } // namespace 223 } // namespace
121 224
122 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ManagedModeNavigationObserver); 225 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ManagedModeNavigationObserver);
123 226
124 ManagedModeNavigationObserver::~ManagedModeNavigationObserver() {} 227 ManagedModeNavigationObserver::~ManagedModeNavigationObserver() {
228 RemoveTemporaryException();
229 }
125 230
126 ManagedModeNavigationObserver::ManagedModeNavigationObserver( 231 ManagedModeNavigationObserver::ManagedModeNavigationObserver(
127 content::WebContents* web_contents) 232 content::WebContents* web_contents)
128 : WebContentsObserver(web_contents), 233 : WebContentsObserver(web_contents),
129 url_filter_(ManagedMode::GetURLFilterForUIThread()), 234 url_filter_(ManagedMode::GetURLFilterForUIThread()),
130 warn_infobar_delegate_(NULL) {} 235 warn_infobar_delegate_(NULL),
236 preview_infobar_delegate_(NULL),
237 state_(RECORDING_URLS_BEFORE_PREVIEW),
238 last_allowed_page_(-1) {}
239
240 void ManagedModeNavigationObserver::AddTemporaryException() {
241 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
242 DCHECK(web_contents());
243
244 BrowserThread::PostTask(
245 BrowserThread::IO,
246 FROM_HERE,
247 base::Bind(&ManagedModeResourceThrottle::AddTemporaryException,
248 web_contents()->GetRenderProcessHost()->GetID(),
249 web_contents()->GetRenderViewHost()->GetRoutingID(),
250 last_url_));
251 }
252
253 void ManagedModeNavigationObserver::RemoveTemporaryException() {
254 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
255 // When closing the browser web_contents() may return NULL so guard against
256 // that.
257 if (!web_contents())
258 return;
259
260 BrowserThread::PostTask(
261 BrowserThread::IO,
262 FROM_HERE,
263 base::Bind(&ManagedModeResourceThrottle::RemoveTemporaryException,
264 web_contents()->GetRenderProcessHost()->GetID(),
265 web_contents()->GetRenderViewHost()->GetRoutingID()));
266 }
131 267
132 void ManagedModeNavigationObserver::WarnInfobarDismissed() { 268 void ManagedModeNavigationObserver::WarnInfobarDismissed() {
133 DCHECK(warn_infobar_delegate_); 269 DCHECK(warn_infobar_delegate_);
134 warn_infobar_delegate_ = NULL; 270 warn_infobar_delegate_ = NULL;
135 } 271 }
136 272
273 void ManagedModeNavigationObserver::PreviewInfobarDismissed() {
274 DCHECK(preview_infobar_delegate_);
275 preview_infobar_delegate_ = NULL;
276 }
277
278 void ManagedModeNavigationObserver::AddSavedURLsToWhitelistAndClearState() {
279 ListValue whitelist;
280 for (std::set<GURL>::const_iterator it = navigated_urls_.begin();
281 it != navigated_urls_.end();
282 ++it) {
283 whitelist.AppendString(it->scheme() + "://." + it->host() + it->path());
284 }
285 if (last_url_.is_valid()) {
286 if (last_url_.SchemeIs("https")) {
287 whitelist.AppendString("https://" + last_url_.host());
288 } else {
289 whitelist.AppendString(last_url_.host());
290 }
291 }
292 ManagedMode::AddToManualList(true, whitelist);
293 ClearObserverState();
294 }
295
296 void ManagedModeNavigationObserver::AddURLToPatternList(const GURL& url) {
297 DCHECK(state_ != NOT_RECORDING_URLS);
298 navigated_urls_.insert(url);
299 }
300
301 void ManagedModeNavigationObserver::AddURLAsLastPattern(const GURL& url) {
302 DCHECK(state_ != NOT_RECORDING_URLS);
303
304 // Erase the last |url| if it is present in the |navigated_urls_|. This stops
305 // us from having both http://.www.google.com (exact URL from the pattern
306 // list) and www.google.com (hostname from the last URL pattern) in the list.
307 navigated_urls_.erase(url);
308 last_url_ = url;
309 }
310
311 void ManagedModeNavigationObserver::SetStateToRecordingAfterPreview() {
312 state_ = RECORDING_URLS_AFTER_PREVIEW;
313 }
314
315 bool ManagedModeNavigationObserver::CanTemporarilyNavigateHost(
316 const GURL& url) {
317 if (last_url_.scheme() == "https") {
318 return url.scheme() == "https" && last_url_.host() == url.host();
319 }
320 return last_url_.host() == url.host();
321 }
322
323 void ManagedModeNavigationObserver::ClearObserverState() {
324 if (state_ == NOT_RECORDING_URLS && preview_infobar_delegate_) {
325 InfoBarService* infobar_service =
326 InfoBarService::FromWebContents(web_contents());
327 infobar_service->RemoveInfoBar(preview_infobar_delegate_);
328 preview_infobar_delegate_ = NULL;
329 }
330 navigated_urls_.clear();
331 last_url_ = GURL();
332 state_ = RECORDING_URLS_BEFORE_PREVIEW;
333 RemoveTemporaryException();
334 }
335
336 void ManagedModeNavigationObserver::NavigateToPendingEntry(
337 const GURL& url,
338 content::NavigationController::ReloadType reload_type) {
339
340 // This method gets called first when a user navigates to a (new) URL.
341 // This means that the data related to the list of URLs needs to be cleared
342 // in certain circumstances.
343 if (web_contents()->GetController().GetCurrentEntryIndex() <
344 last_allowed_page_ || !CanTemporarilyNavigateHost(url)) {
345 ClearObserverState();
346 }
347 }
348
349 void ManagedModeNavigationObserver::DidNavigateMainFrame(
350 const content::LoadCommittedDetails& details,
351 const content::FrameNavigateParams& params) {
352
353 ManagedModeURLFilter::FilteringBehavior behavior =
354 url_filter_->GetFilteringBehaviorForURL(params.url);
355
356 // If the user just saw an interstitial this is the final URL so it is
357 // recorded. Checking for filtering behavior here isn't useful because
358 // although this specific URL can be allowed the hostname will be added which
359 // is more general. The hostname will be checked later when it is
360 // added to the actual whitelist to see if it is already present.
361 if (behavior == ManagedModeURLFilter::BLOCK && state_ != NOT_RECORDING_URLS)
362 AddURLAsLastPattern(params.url);
363
364 if (behavior == ManagedModeURLFilter::ALLOW &&
365 state_ != RECORDING_URLS_BEFORE_PREVIEW) {
366 // The initial page that triggered the interstitial was blocked but the
367 // final page is already in the whitelist so add the series of URLs
368 // which lead to the final page to the whitelist as well.
369 AddSavedURLsToWhitelistAndClearState();
370 SimpleAlertInfoBarDelegate::Create(
371 InfoBarService::FromWebContents(web_contents()),
372 NULL,
373 l10n_util::GetStringUTF16(IDS_MANAGED_MODE_ALREADY_ADDED_MESSAGE),
374 true);
375 return;
376 }
377
378 if (state_ == RECORDING_URLS_AFTER_PREVIEW) {
379 // A temporary exception should be added only if an interstitial was shown,
380 // the user clicked preview and the final page was not allowed. This
381 // temporary exception stops the interstitial from showing on further
382 // navigations to that host so that the user can navigate around to
383 // inspect it.
384 state_ = NOT_RECORDING_URLS;
385 AddTemporaryException();
386 }
387 }
388
389 void ManagedModeNavigationObserver::DidStartProvisionalLoadForFrame(
390 int64 frame_id,
391 int64 parent_frame_id,
392 bool is_main_frame,
393 const GURL& validated_url,
394 bool is_error_page,
395 bool is_iframe_srcdoc,
396 content::RenderViewHost* render_view_host) {
397 if (!is_main_frame)
398 return;
399 }
400
401 void ManagedModeNavigationObserver::ProvisionalChangeToMainFrameUrl(
402 const GURL& url,
403 content::RenderViewHost* render_view_host) {
404 // This function is the last one to be called before the resource throttle
405 // shows the interstitial if the URL must be blocked.
406 ManagedModeURLFilter::FilteringBehavior behavior =
407 url_filter_->GetFilteringBehaviorForURL(url);
408
409 if (state_ == NOT_RECORDING_URLS && !CanTemporarilyNavigateHost(url))
410 ClearObserverState();
411
412 if (behavior == ManagedModeURLFilter::BLOCK && state_ != NOT_RECORDING_URLS)
413 AddURLToPatternList(url);
414 }
415
137 void ManagedModeNavigationObserver::DidCommitProvisionalLoadForFrame( 416 void ManagedModeNavigationObserver::DidCommitProvisionalLoadForFrame(
138 int64 frame_id, 417 int64 frame_id,
139 bool is_main_frame, 418 bool is_main_frame,
140 const GURL& url, 419 const GURL& url,
141 content::PageTransition transition_type, 420 content::PageTransition transition_type,
142 content::RenderViewHost* render_view_host) { 421 content::RenderViewHost* render_view_host) {
143 if (!is_main_frame) 422 if (!is_main_frame)
144 return; 423 return;
145 424
146 ManagedModeURLFilter::FilteringBehavior behavior = 425 ManagedModeURLFilter::FilteringBehavior behavior =
147 url_filter_->GetFilteringBehaviorForURL(url); 426 url_filter_->GetFilteringBehaviorForURL(url);
148 427
149 if (behavior == ManagedModeURLFilter::WARN) { 428 if (behavior == ManagedModeURLFilter::WARN) {
150 if (!warn_infobar_delegate_) { 429 if (!warn_infobar_delegate_) {
151 warn_infobar_delegate_ = ManagedModeWarningInfobarDelegate::Create( 430 warn_infobar_delegate_ = ManagedModeWarningInfobarDelegate::Create(
152 InfoBarService::FromWebContents(web_contents())); 431 InfoBarService::FromWebContents(web_contents()), last_allowed_page_);
153 } 432 }
154 } else { 433 } else {
155 if (warn_infobar_delegate_) { 434 if (warn_infobar_delegate_) {
156 InfoBarService* infobar_service = 435 InfoBarService* infobar_service =
157 InfoBarService::FromWebContents(web_contents()); 436 InfoBarService::FromWebContents(web_contents());
158 infobar_service->RemoveInfoBar(warn_infobar_delegate_); 437 infobar_service->RemoveInfoBar(warn_infobar_delegate_);
159 warn_infobar_delegate_= NULL; 438 warn_infobar_delegate_ = NULL;
160 } 439 }
161 } 440 }
162 441
442 if (behavior == ManagedModeURLFilter::BLOCK) {
443 switch (state_) {
444 case RECORDING_URLS_BEFORE_PREVIEW:
445 // Should not be in this state with a blocked URL.
446 NOTREACHED();
447 break;
448 case RECORDING_URLS_AFTER_PREVIEW:
449 // Add the infobar.
450 if (!preview_infobar_delegate_) {
451 preview_infobar_delegate_ =
452 ManagedModePreviewInfobarDelegate::Create(
453 InfoBarService::FromWebContents(web_contents()));
454 }
455 break;
456 case NOT_RECORDING_URLS:
457 // Check that the infobar is present.
458 DCHECK(preview_infobar_delegate_);
459 break;
460 }
461 }
462
463 if (behavior == ManagedModeURLFilter::ALLOW)
464 last_allowed_page_ = web_contents()->GetController().GetCurrentEntryIndex();
163 } 465 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698