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

Side by Side Diff: chrome/browser/ui/content_settings/content_setting_image_model.cc

Issue 1312453005: Removed Profile::GetHostContentSettingsMap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed patch conflict Created 5 years, 3 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/ui/content_settings/content_setting_image_model.h" 5 #include "chrome/browser/ui/content_settings/content_setting_image_model.h"
6 6
7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
7 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
8 #include "chrome/browser/prerender/prerender_manager.h" 9 #include "chrome/browser/prerender/prerender_manager.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/grit/generated_resources.h" 11 #include "chrome/grit/generated_resources.h"
11 #include "components/content_settings/core/browser/host_content_settings_map.h" 12 #include "components/content_settings/core/browser/host_content_settings_map.h"
12 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
13 #include "grit/theme_resources.h" 14 #include "grit/theme_resources.h"
14 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
15 #include "ui/base/resource/material_design/material_design_controller.h" 16 #include "ui/base/resource/material_design/material_design_controller.h"
16 #include "ui/base/resource/resource_bundle.h" 17 #include "ui/base/resource/resource_bundle.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 IDS_BLOCKED_DOWNLOADS_EXPLANATION}, 191 IDS_BLOCKED_DOWNLOADS_EXPLANATION},
191 }; 192 };
192 int explanation_id = GetIdForContentType( 193 int explanation_id = GetIdForContentType(
193 kBlockedExplanatoryTextIDs, arraysize(kBlockedExplanatoryTextIDs), type); 194 kBlockedExplanatoryTextIDs, arraysize(kBlockedExplanatoryTextIDs), type);
194 195
195 // For plugins, don't show the animated explanation unless the plugin was 196 // For plugins, don't show the animated explanation unless the plugin was
196 // blocked despite the user's content settings being set to allow it (e.g. 197 // blocked despite the user's content settings being set to allow it (e.g.
197 // due to auto-blocking NPAPI plugins). 198 // due to auto-blocking NPAPI plugins).
198 Profile* profile = 199 Profile* profile =
199 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 200 Profile::FromBrowserContext(web_contents->GetBrowserContext());
200 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); 201 HostContentSettingsMap* map =
202 HostContentSettingsMapFactory::GetForProfile(profile);
201 if (type == CONTENT_SETTINGS_TYPE_PLUGINS) { 203 if (type == CONTENT_SETTINGS_TYPE_PLUGINS) {
202 GURL url = web_contents->GetURL(); 204 GURL url = web_contents->GetURL();
203 if (map->GetContentSetting(url, url, type, std::string()) != 205 if (map->GetContentSetting(url, url, type, std::string()) !=
204 CONTENT_SETTING_ALLOW) 206 CONTENT_SETTING_ALLOW)
205 explanation_id = 0; 207 explanation_id = 0;
206 } 208 }
207 209
208 // If a content type is blocked by default and was accessed, display the 210 // If a content type is blocked by default and was accessed, display the
209 // content blocked page action. 211 // content blocked page action.
210 TabSpecificContentSettings* content_settings = 212 TabSpecificContentSettings* content_settings =
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 icon_ = ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(id); 478 icon_ = ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(id);
477 } 479 }
478 480
479 #if !defined(OS_MACOSX) 481 #if !defined(OS_MACOSX)
480 void ContentSettingImageModel::SetIconByVectorId(gfx::VectorIconId id, 482 void ContentSettingImageModel::SetIconByVectorId(gfx::VectorIconId id,
481 bool blocked) { 483 bool blocked) {
482 icon_ = GetIcon(id, blocked ? gfx::VectorIconId::BLOCKED_BADGE 484 icon_ = GetIcon(id, blocked ? gfx::VectorIconId::BLOCKED_BADGE
483 : gfx::VectorIconId::VECTOR_ICON_NONE); 485 : gfx::VectorIconId::VECTOR_ICON_NONE);
484 } 486 }
485 #endif 487 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698