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

Side by Side Diff: chrome/browser/infobars/insecure_content_infobar_delegate.cc

Issue 211273007: Split InfoBarService core code into InfoBarManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + comments 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/infobars/insecure_content_infobar_delegate.h" 5 #include "chrome/browser/infobars/insecure_content_infobar_delegate.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "chrome/browser/google/google_util.h" 8 #include "chrome/browser/google/google_util.h"
9 #include "chrome/browser/infobars/infobar.h" 9 #include "chrome/browser/infobars/infobar.h"
10 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
11 #include "chrome/browser/infobars/infobar_service.h"
11 #include "chrome/common/render_messages.h" 12 #include "chrome/common/render_messages.h"
12 #include "content/public/browser/render_frame_host.h" 13 #include "content/public/browser/render_frame_host.h"
13 #include "content/public/browser/render_view_host.h" 14 #include "content/public/browser/render_view_host.h"
14 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
15 #include "content/public/common/page_transition_types.h" 16 #include "content/public/common/page_transition_types.h"
16 #include "grit/generated_resources.h" 17 #include "grit/generated_resources.h"
17 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
18 19
19 20
20 // static 21 // static
21 void InsecureContentInfoBarDelegate::Create(InfoBarService* infobar_service, 22 void InsecureContentInfoBarDelegate::Create(InfoBarService* infobar_service,
22 InfoBarType type) { 23 InfoBarType type) {
23 scoped_ptr<InfoBar> new_infobar(ConfirmInfoBarDelegate::CreateInfoBar( 24 scoped_ptr<InfoBar> new_infobar(ConfirmInfoBarDelegate::CreateInfoBar(
24 scoped_ptr<ConfirmInfoBarDelegate>( 25 scoped_ptr<ConfirmInfoBarDelegate>(
25 new InsecureContentInfoBarDelegate(type)))); 26 new InsecureContentInfoBarDelegate(type))));
26 27
27 // Only supsersede an existing insecure content infobar if we are upgrading 28 // Only supsersede an existing insecure content infobar if we are upgrading
28 // from DISPLAY to RUN. 29 // from DISPLAY to RUN.
29 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) { 30 InfoBarManager* infobar_manager = infobar_service->infobar_manager();
30 InfoBar* old_infobar = infobar_service->infobar_at(i); 31 for (size_t i = 0; i < infobar_manager->infobar_count(); ++i) {
32 InfoBar* old_infobar = infobar_manager->infobar_at(i);
31 InsecureContentInfoBarDelegate* delegate = 33 InsecureContentInfoBarDelegate* delegate =
32 old_infobar->delegate()->AsInsecureContentInfoBarDelegate(); 34 old_infobar->delegate()->AsInsecureContentInfoBarDelegate();
33 if (delegate != NULL) { 35 if (delegate != NULL) {
34 if ((type == RUN) && (delegate->type_ == DISPLAY)) 36 if ((type == RUN) && (delegate->type_ == DISPLAY))
35 return; 37 return;
36 infobar_service->ReplaceInfoBar(old_infobar, new_infobar.Pass()); 38 infobar_service->ReplaceInfoBar(old_infobar, new_infobar.Pass());
37 break; 39 break;
38 } 40 }
39 } 41 }
40 if (new_infobar.get()) 42 if (new_infobar.get())
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 bool InsecureContentInfoBarDelegate::LinkClicked( 110 bool InsecureContentInfoBarDelegate::LinkClicked(
109 WindowOpenDisposition disposition) { 111 WindowOpenDisposition disposition) {
110 web_contents()->OpenURL(content::OpenURLParams( 112 web_contents()->OpenURL(content::OpenURLParams(
111 google_util::AppendGoogleLocaleParam(GURL("https://www.google.com/" 113 google_util::AppendGoogleLocaleParam(GURL("https://www.google.com/"
112 "support/chrome/bin/answer.py?answer=1342714")), 114 "support/chrome/bin/answer.py?answer=1342714")),
113 content::Referrer(), 115 content::Referrer(),
114 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 116 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
115 content::PAGE_TRANSITION_LINK, false)); 117 content::PAGE_TRANSITION_LINK, false));
116 return false; 118 return false;
117 } 119 }
OLDNEW
« no previous file with comments | « chrome/browser/infobars/infobars_browsertest.cc ('k') | chrome/browser/managed_mode/managed_mode_interstitial.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698