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

Side by Side Diff: chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc

Issue 14241006: Eliminate InfoBarTabHelper. Make InfoBarService a concrete class. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 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/custom_handlers/register_protocol_handler_infobar_deleg ate.h" 5 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg ate.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 8 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
9 #include "chrome/browser/infobars/infobar_service.h" 9 #include "chrome/browser/infobars/infobar_service.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
(...skipping 11 matching lines...) Expand all
22 InfoBarService* infobar_service, 22 InfoBarService* infobar_service,
23 ProtocolHandlerRegistry* registry, 23 ProtocolHandlerRegistry* registry,
24 const ProtocolHandler& handler) { 24 const ProtocolHandler& handler) {
25 content::RecordAction( 25 content::RecordAction(
26 content::UserMetricsAction("RegisterProtocolHandler.InfoBar_Shown")); 26 content::UserMetricsAction("RegisterProtocolHandler.InfoBar_Shown"));
27 27
28 scoped_ptr<InfoBarDelegate> infobar( 28 scoped_ptr<InfoBarDelegate> infobar(
29 new RegisterProtocolHandlerInfoBarDelegate(infobar_service, registry, 29 new RegisterProtocolHandlerInfoBarDelegate(infobar_service, registry,
30 handler)); 30 handler));
31 31
32 for (size_t i = 0; i < infobar_service->GetInfoBarCount(); ++i) { 32 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) {
33 RegisterProtocolHandlerInfoBarDelegate* existing_delegate = 33 RegisterProtocolHandlerInfoBarDelegate* existing_delegate =
34 infobar_service->GetInfoBarDelegateAt(i)-> 34 infobar_service->infobar_at(i)->
35 AsRegisterProtocolHandlerInfoBarDelegate(); 35 AsRegisterProtocolHandlerInfoBarDelegate();
36 if ((existing_delegate != NULL) && 36 if ((existing_delegate != NULL) &&
37 existing_delegate->handler_.IsEquivalent(handler)) { 37 existing_delegate->handler_.IsEquivalent(handler)) {
38 infobar_service->ReplaceInfoBar(existing_delegate, infobar.Pass()); 38 infobar_service->ReplaceInfoBar(existing_delegate, infobar.Pass());
39 return; 39 return;
40 } 40 }
41 } 41 }
42 42
43 infobar_service->AddInfoBar(infobar.Pass()); 43 infobar_service->AddInfoBar(infobar.Pass());
44 } 44 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 bool RegisterProtocolHandlerInfoBarDelegate::LinkClicked( 116 bool RegisterProtocolHandlerInfoBarDelegate::LinkClicked(
117 WindowOpenDisposition disposition) { 117 WindowOpenDisposition disposition) {
118 content::RecordAction( 118 content::RecordAction(
119 UserMetricsAction("RegisterProtocolHandler.InfoBar_LearnMore")); 119 UserMetricsAction("RegisterProtocolHandler.InfoBar_LearnMore"));
120 OpenURLParams params( 120 OpenURLParams params(
121 GURL(chrome::kLearnMoreRegisterProtocolHandlerURL), 121 GURL(chrome::kLearnMoreRegisterProtocolHandlerURL),
122 Referrer(), 122 Referrer(),
123 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 123 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
124 content::PAGE_TRANSITION_LINK, 124 content::PAGE_TRANSITION_LINK,
125 false); 125 false);
126 owner()->GetWebContents()->OpenURL(params); 126 owner()->web_contents()->OpenURL(params);
127 return false; 127 return false;
128 } 128 }
129 129
130 RegisterProtocolHandlerInfoBarDelegate* 130 RegisterProtocolHandlerInfoBarDelegate*
131 RegisterProtocolHandlerInfoBarDelegate:: 131 RegisterProtocolHandlerInfoBarDelegate::
132 AsRegisterProtocolHandlerInfoBarDelegate() { 132 AsRegisterProtocolHandlerInfoBarDelegate() {
133 return this; 133 return this;
134 } 134 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/browser/download/download_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698