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

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

Issue 19375002: Move GeolocationSettingsState to ContentSettingsUsagesState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review #9 Created 7 years, 5 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/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.h" 7 #include "chrome/browser/content_settings/host_content_settings_map.h"
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
9 #include "chrome/browser/prerender/prerender_manager.h" 9 #include "chrome/browser/prerender/prerender_manager.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 void ContentSettingGeolocationImageModel::UpdateFromWebContents( 168 void ContentSettingGeolocationImageModel::UpdateFromWebContents(
169 WebContents* web_contents) { 169 WebContents* web_contents) {
170 set_visible(false); 170 set_visible(false);
171 if (!web_contents) 171 if (!web_contents)
172 return; 172 return;
173 TabSpecificContentSettings* content_settings = 173 TabSpecificContentSettings* content_settings =
174 TabSpecificContentSettings::FromWebContents(web_contents); 174 TabSpecificContentSettings::FromWebContents(web_contents);
175 if (!content_settings) 175 if (!content_settings)
176 return; 176 return;
177 const GeolocationSettingsState& settings_state = content_settings-> 177 const ContentSettingsUsagesState& usages_state = content_settings->
178 geolocation_settings_state(); 178 geolocation_usages_state();
179 if (settings_state.state_map().empty()) 179 if (usages_state.state_map().empty())
180 return; 180 return;
181 set_visible(true); 181 set_visible(true);
182 182
183 // If any embedded site has access the allowed icon takes priority over the 183 // If any embedded site has access the allowed icon takes priority over the
184 // blocked icon. 184 // blocked icon.
185 unsigned int tab_state_flags = 0; 185 unsigned int state_flags = 0;
186 settings_state.GetDetailedInfo(NULL, &tab_state_flags); 186 usages_state.GetDetailedInfo(NULL, &state_flags);
187 bool allowed = 187 bool allowed =
188 !!(tab_state_flags & GeolocationSettingsState::TABSTATE_HAS_ANY_ALLOWED); 188 !!(state_flags & ContentSettingsUsagesState::TABSTATE_HAS_ANY_ALLOWED);
189 set_icon(allowed ? IDR_ALLOWED_LOCATION : IDR_BLOCKED_LOCATION); 189 set_icon(allowed ? IDR_ALLOWED_LOCATION : IDR_BLOCKED_LOCATION);
190 set_tooltip(l10n_util::GetStringUTF8(allowed ? 190 set_tooltip(l10n_util::GetStringUTF8(allowed ?
191 IDS_GEOLOCATION_ALLOWED_TOOLTIP : IDS_GEOLOCATION_BLOCKED_TOOLTIP)); 191 IDS_GEOLOCATION_ALLOWED_TOOLTIP : IDS_GEOLOCATION_BLOCKED_TOOLTIP));
192 } 192 }
193 193
194 ContentSettingMediaImageModel::ContentSettingMediaImageModel( 194 ContentSettingMediaImageModel::ContentSettingMediaImageModel(
195 ContentSettingsType type) 195 ContentSettingsType type)
196 : ContentSettingImageModel(type) { 196 : ContentSettingImageModel(type) {
197 } 197 }
198 198
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 case CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS: 317 case CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS:
318 return new ContentSettingRPHImageModel(); 318 return new ContentSettingRPHImageModel();
319 case CONTENT_SETTINGS_TYPE_MEDIASTREAM: 319 case CONTENT_SETTINGS_TYPE_MEDIASTREAM:
320 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: 320 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC:
321 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: 321 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA:
322 return new ContentSettingMediaImageModel(content_settings_type); 322 return new ContentSettingMediaImageModel(content_settings_type);
323 default: 323 default:
324 return new ContentSettingBlockedImageModel(content_settings_type); 324 return new ContentSettingBlockedImageModel(content_settings_type);
325 } 325 }
326 } 326 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/content_settings/content_setting_bubble_model.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698