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

Side by Side Diff: chrome/browser/pepper_broker_infobar_delegate.cc

Issue 2711623003: Update infobars to use VectorIcon struct instead of VectorIconId. (Closed)
Patch Set: rebase Created 3 years, 10 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
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/pepper_broker_infobar_delegate.h" 5 #include "chrome/browser/pepper_broker_infobar_delegate.h"
6 6
7 #include "chrome/app/vector_icons/vector_icons.h"
7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
9 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
10 #include "chrome/browser/plugins/plugin_finder.h" 11 #include "chrome/browser/plugins/plugin_finder.h"
11 #include "chrome/browser/plugins/plugin_metadata.h" 12 #include "chrome/browser/plugins/plugin_metadata.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/grit/generated_resources.h" 14 #include "chrome/grit/generated_resources.h"
14 #include "components/content_settings/core/browser/host_content_settings_map.h" 15 #include "components/content_settings/core/browser/host_content_settings_map.h"
15 #include "components/infobars/core/infobar.h" 16 #include "components/infobars/core/infobar.h"
16 #include "components/strings/grit/components_strings.h" 17 #include "components/strings/grit/components_strings.h"
17 #include "components/url_formatter/elide_url.h" 18 #include "components/url_formatter/elide_url.h"
18 #include "content/public/browser/page_navigator.h" 19 #include "content/public/browser/page_navigator.h"
19 #include "content/public/browser/plugin_service.h" 20 #include "content/public/browser/plugin_service.h"
20 #include "content/public/browser/user_metrics.h" 21 #include "content/public/browser/user_metrics.h"
21 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
22 #include "content/public/common/referrer.h" 23 #include "content/public/common/referrer.h"
23 #include "content/public/common/webplugininfo.h" 24 #include "content/public/common/webplugininfo.h"
24 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/gfx/vector_icons_public.h"
26 26
27 // static 27 // static
28 void PepperBrokerInfoBarDelegate::Create( 28 void PepperBrokerInfoBarDelegate::Create(
29 content::WebContents* web_contents, 29 content::WebContents* web_contents,
30 const GURL& url, 30 const GURL& url,
31 const base::FilePath& plugin_path, 31 const base::FilePath& plugin_path,
32 const base::Callback<void(bool)>& callback) { 32 const base::Callback<void(bool)>& callback) {
33 Profile* profile = 33 Profile* profile =
34 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 34 Profile::FromBrowserContext(web_contents->GetBrowserContext());
35 // TODO(wad): Add ephemeral device ID support for broker in guest mode. 35 // TODO(wad): Add ephemeral device ID support for broker in guest mode.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 PepperBrokerInfoBarDelegate::~PepperBrokerInfoBarDelegate() { 85 PepperBrokerInfoBarDelegate::~PepperBrokerInfoBarDelegate() {
86 if (!callback_.is_null()) 86 if (!callback_.is_null())
87 callback_.Run(false); 87 callback_.Run(false);
88 } 88 }
89 89
90 infobars::InfoBarDelegate::InfoBarIdentifier 90 infobars::InfoBarDelegate::InfoBarIdentifier
91 PepperBrokerInfoBarDelegate::GetIdentifier() const { 91 PepperBrokerInfoBarDelegate::GetIdentifier() const {
92 return PEPPER_BROKER_INFOBAR_DELEGATE; 92 return PEPPER_BROKER_INFOBAR_DELEGATE;
93 } 93 }
94 94
95 gfx::VectorIconId PepperBrokerInfoBarDelegate::GetVectorIconId() const { 95 const gfx::VectorIcon& PepperBrokerInfoBarDelegate::GetVectorIcon() const {
96 return gfx::VectorIconId::EXTENSION; 96 return kExtensionIcon;
97 } 97 }
98 98
99 base::string16 PepperBrokerInfoBarDelegate::GetMessageText() const { 99 base::string16 PepperBrokerInfoBarDelegate::GetMessageText() const {
100 content::PluginService* plugin_service = 100 content::PluginService* plugin_service =
101 content::PluginService::GetInstance(); 101 content::PluginService::GetInstance();
102 content::WebPluginInfo plugin; 102 content::WebPluginInfo plugin;
103 bool success = plugin_service->GetPluginInfoByPath(plugin_path_, &plugin); 103 bool success = plugin_service->GetPluginInfoByPath(plugin_path_, &plugin);
104 DCHECK(success); 104 DCHECK(success);
105 std::unique_ptr<PluginMetadata> plugin_metadata( 105 std::unique_ptr<PluginMetadata> plugin_metadata(
106 PluginFinder::GetInstance()->GetPluginMetadata(plugin)); 106 PluginFinder::GetInstance()->GetPluginMetadata(plugin));
(...skipping 30 matching lines...) Expand all
137 content::RecordAction(result ? 137 content::RecordAction(result ?
138 base::UserMetricsAction("PPAPI.BrokerInfobarClickedAllow") : 138 base::UserMetricsAction("PPAPI.BrokerInfobarClickedAllow") :
139 base::UserMetricsAction("PPAPI.BrokerInfobarClickedDeny")); 139 base::UserMetricsAction("PPAPI.BrokerInfobarClickedDeny"));
140 callback_.Run(result); 140 callback_.Run(result);
141 callback_ = base::Callback<void(bool)>(); 141 callback_ = base::Callback<void(bool)>();
142 content_settings_->SetContentSettingDefaultScope( 142 content_settings_->SetContentSettingDefaultScope(
143 url_, GURL(), CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string(), 143 url_, GURL(), CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string(),
144 result ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); 144 result ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK);
145 tab_content_settings_->SetPepperBrokerAllowed(result); 145 tab_content_settings_->SetPepperBrokerAllowed(result);
146 } 146 }
OLDNEW
« no previous file with comments | « chrome/browser/pepper_broker_infobar_delegate.h ('k') | chrome/browser/permissions/permission_request_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698