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

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

Issue 2370001: Store blocked cookies in the tab contents. (Closed)
Patch Set: updates Created 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/content_setting_image_model.h" 5 #include "chrome/browser/content_setting_image_model.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "chrome/browser/tab_contents/tab_contents.h" 8 #include "chrome/browser/tab_contents/tab_contents.h"
9 #include "grit/generated_resources.h" 9 #include "grit/generated_resources.h"
10 #include "grit/theme_resources.h" 10 #include "grit/theme_resources.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 }; 52 };
53 53
54 54
55 ContentSettingBlockedImageModel::ContentSettingBlockedImageModel( 55 ContentSettingBlockedImageModel::ContentSettingBlockedImageModel(
56 ContentSettingsType content_settings_type) 56 ContentSettingsType content_settings_type)
57 : ContentSettingImageModel(content_settings_type) { 57 : ContentSettingImageModel(content_settings_type) {
58 } 58 }
59 59
60 void ContentSettingBlockedImageModel::UpdateFromTabContents( 60 void ContentSettingBlockedImageModel::UpdateFromTabContents(
61 const TabContents* tab_contents) { 61 const TabContents* tab_contents) {
62 if (!tab_contents || 62 TabSpecificContentSettings* content_settings = tab_contents ?
63 !tab_contents->IsContentBlocked(get_content_settings_type())) { 63 tab_contents->GetTabSpecificContentSettings() : NULL;
64 if (!content_settings ||
65 !content_settings->IsContentBlocked(get_content_settings_type())) {
64 set_visible(false); 66 set_visible(false);
65 return; 67 return;
66 } 68 }
67 set_icon(kBlockedIconIDs[get_content_settings_type()]); 69 set_icon(kBlockedIconIDs[get_content_settings_type()]);
68 set_tooltip( 70 set_tooltip(
69 l10n_util::GetStringUTF8(kTooltipIDs[get_content_settings_type()])); 71 l10n_util::GetStringUTF8(kTooltipIDs[get_content_settings_type()]));
70 set_visible(true); 72 set_visible(true);
71 } 73 }
72 74
73 ContentSettingGeolocationImageModel::ContentSettingGeolocationImageModel() 75 ContentSettingGeolocationImageModel::ContentSettingGeolocationImageModel()
74 : ContentSettingImageModel(CONTENT_SETTINGS_TYPE_GEOLOCATION) { 76 : ContentSettingImageModel(CONTENT_SETTINGS_TYPE_GEOLOCATION) {
75 } 77 }
76 78
77 void ContentSettingGeolocationImageModel::UpdateFromTabContents( 79 void ContentSettingGeolocationImageModel::UpdateFromTabContents(
78 const TabContents* tab_contents) { 80 const TabContents* tab_contents) {
79 if (!tab_contents) { 81 if (!tab_contents) {
80 set_visible(false); 82 set_visible(false);
81 return; 83 return;
82 } 84 }
85 TabSpecificContentSettings* content_settings =
86 tab_contents->GetTabSpecificContentSettings();
83 const GeolocationSettingsState& settings_state = 87 const GeolocationSettingsState& settings_state =
84 tab_contents->geolocation_settings_state(); 88 content_settings->geolocation_settings_state();
85 if (settings_state.state_map().empty()) { 89 if (settings_state.state_map().empty()) {
86 set_visible(false); 90 set_visible(false);
87 return; 91 return;
88 } 92 }
89 set_visible(true); 93 set_visible(true);
90 unsigned int tab_state_flags = 0; 94 unsigned int tab_state_flags = 0;
91 settings_state.GetDetailedInfo(NULL, &tab_state_flags); 95 settings_state.GetDetailedInfo(NULL, &tab_state_flags);
92 // If any embedded site has access the allowed icon takes priority over the 96 // If any embedded site has access the allowed icon takes priority over the
93 // blocked icon. 97 // blocked icon.
94 if (tab_state_flags & GeolocationSettingsState::TABSTATE_HAS_ANY_ALLOWED) { 98 if (tab_state_flags & GeolocationSettingsState::TABSTATE_HAS_ANY_ALLOWED) {
(...skipping 25 matching lines...) Expand all
120 // static 124 // static
121 ContentSettingImageModel* 125 ContentSettingImageModel*
122 ContentSettingImageModel::CreateContentSettingImageModel( 126 ContentSettingImageModel::CreateContentSettingImageModel(
123 ContentSettingsType content_settings_type) { 127 ContentSettingsType content_settings_type) {
124 if (content_settings_type == CONTENT_SETTINGS_TYPE_GEOLOCATION) 128 if (content_settings_type == CONTENT_SETTINGS_TYPE_GEOLOCATION)
125 return new ContentSettingGeolocationImageModel(); 129 return new ContentSettingGeolocationImageModel();
126 if (content_settings_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) 130 if (content_settings_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS)
127 return new ContentSettingNotificationsImageModel(); 131 return new ContentSettingNotificationsImageModel();
128 return new ContentSettingBlockedImageModel(content_settings_type); 132 return new ContentSettingBlockedImageModel(content_settings_type);
129 } 133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698