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

Side by Side Diff: chrome/browser/net/spdyproxy/data_reduction_proxy_infobar_delegate.cc

Issue 812823002: Remove dependency of infobars component on the embedder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on Android Created 6 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/net/spdyproxy/data_reduction_proxy_infobar_delegate.h" 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_infobar_delegate.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/infobars/infobar_service.h" 8 #include "chrome/browser/infobars/infobar_service.h"
9 #include "components/infobars/core/infobar.h" 9 #include "components/infobars/core/infobar.h"
10 #include "components/infobars/core/infobar_delegate.h" 10 #include "components/infobars/core/infobar_delegate.h"
11 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
12 #include "grit/components_strings.h" 12 #include "grit/components_strings.h"
13 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 // static 16 // static
17 void DataReductionProxyInfoBarDelegate::Create( 17 void DataReductionProxyInfoBarDelegate::Create(
18 content::WebContents* web_contents, const std::string& link_url) { 18 content::WebContents* web_contents, const std::string& link_url) {
19 InfoBarService::FromWebContents(web_contents)->AddInfoBar( 19 InfoBarService* infobar_service =
20 InfoBarService::FromWebContents(web_contents);
21 infobar_service->AddInfoBar(
20 DataReductionProxyInfoBarDelegate::CreateInfoBar( 22 DataReductionProxyInfoBarDelegate::CreateInfoBar(
23 infobar_service,
21 scoped_ptr<DataReductionProxyInfoBarDelegate>( 24 scoped_ptr<DataReductionProxyInfoBarDelegate>(
22 new DataReductionProxyInfoBarDelegate(link_url)))); 25 new DataReductionProxyInfoBarDelegate(link_url))));
23 } 26 }
24 27
25 #if !defined(OS_ANDROID) 28 #if !defined(OS_ANDROID)
26 // This infobar currently only supports Android. 29 // This infobar currently only supports Android.
27 30
28 // static 31 // static
29 scoped_ptr<infobars::InfoBar> DataReductionProxyInfoBarDelegate::CreateInfoBar( 32 scoped_ptr<infobars::InfoBar> DataReductionProxyInfoBarDelegate::CreateInfoBar(
33 infobars::InfoBarManager* infobar_manager,
30 scoped_ptr<DataReductionProxyInfoBarDelegate> delegate) { 34 scoped_ptr<DataReductionProxyInfoBarDelegate> delegate) {
31 return ConfirmInfoBarDelegate::CreateInfoBar(delegate.Pass()); 35 return infobar_manager->CreateConfirmInfoBar(delegate.Pass());
32 } 36 }
33 #endif 37 #endif
34 38
35 DataReductionProxyInfoBarDelegate::~DataReductionProxyInfoBarDelegate() { 39 DataReductionProxyInfoBarDelegate::~DataReductionProxyInfoBarDelegate() {
36 } 40 }
37 41
38 DataReductionProxyInfoBarDelegate::DataReductionProxyInfoBarDelegate( 42 DataReductionProxyInfoBarDelegate::DataReductionProxyInfoBarDelegate(
39 const std::string& link_url) 43 const std::string& link_url)
40 : ConfirmInfoBarDelegate(), 44 : ConfirmInfoBarDelegate(),
41 link_url_(link_url) { 45 link_url_(link_url) {
(...skipping 15 matching lines...) Expand all
57 bool DataReductionProxyInfoBarDelegate::LinkClicked( 61 bool DataReductionProxyInfoBarDelegate::LinkClicked(
58 WindowOpenDisposition disposition) { 62 WindowOpenDisposition disposition) {
59 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( 63 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL(
60 content::OpenURLParams( 64 content::OpenURLParams(
61 GURL(link_url_), 65 GURL(link_url_),
62 content::Referrer(), 66 content::Referrer(),
63 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 67 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
64 ui::PAGE_TRANSITION_LINK, false)); 68 ui::PAGE_TRANSITION_LINK, false));
65 return true; 69 return true;
66 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698