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

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

Issue 2878075: Introduce a resource identifier for content settings. (Closed)
Patch Set: updates Created 10 years, 4 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
« no previous file with comments | « chrome/browser/content_exceptions_table_model.cc ('k') | chrome/browser/cookie_modal_dialog.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_bubble_model.h" 5 #include "chrome/browser/content_setting_bubble_model.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/browser/blocked_popup_container.h" 9 #include "chrome/browser/blocked_popup_container.h"
10 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" 10 #include "chrome/browser/geolocation/geolocation_content_settings_map.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 COMPILE_ASSERT(arraysize(kBlockIDs) == CONTENT_SETTINGS_NUM_TYPES, 159 COMPILE_ASSERT(arraysize(kBlockIDs) == CONTENT_SETTINGS_NUM_TYPES,
160 Need_a_setting_for_every_content_settings_type); 160 Need_a_setting_for_every_content_settings_type);
161 std::string radio_block_label; 161 std::string radio_block_label;
162 radio_block_label = l10n_util::GetStringFUTF8( 162 radio_block_label = l10n_util::GetStringFUTF8(
163 kBlockIDs[content_type()], UTF8ToUTF16(display_host)); 163 kBlockIDs[content_type()], UTF8ToUTF16(display_host));
164 164
165 radio_group.radio_items.push_back(radio_allow_label); 165 radio_group.radio_items.push_back(radio_allow_label);
166 radio_group.radio_items.push_back(radio_block_label); 166 radio_group.radio_items.push_back(radio_block_label);
167 radio_group.default_item = 167 radio_group.default_item =
168 profile()->GetHostContentSettingsMap()->GetContentSetting(url, 168 profile()->GetHostContentSettingsMap()->GetContentSetting(url,
169 content_type()) == CONTENT_SETTING_ALLOW ? 0 : 1; 169 content_type(), "") == CONTENT_SETTING_ALLOW ? 0 : 1;
170 set_radio_group(radio_group); 170 set_radio_group(radio_group);
171 } 171 }
172 172
173 virtual void OnRadioClicked(int radio_index) { 173 virtual void OnRadioClicked(int radio_index) {
174 profile()->GetHostContentSettingsMap()->AddExceptionForURL( 174 profile()->GetHostContentSettingsMap()->AddExceptionForURL(
175 bubble_content().radio_group.url, 175 bubble_content().radio_group.url,
176 content_type(), 176 content_type(),
177 "",
177 radio_index == 0 ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); 178 radio_index == 0 ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK);
178 } 179 }
179 }; 180 };
180 181
181 class ContentSettingPluginBubbleModel : public ContentSettingSingleRadioGroup { 182 class ContentSettingPluginBubbleModel : public ContentSettingSingleRadioGroup {
182 public: 183 public:
183 ContentSettingPluginBubbleModel(TabContents* tab_contents, Profile* profile, 184 ContentSettingPluginBubbleModel(TabContents* tab_contents, Profile* profile,
184 ContentSettingsType content_type) 185 ContentSettingsType content_type)
185 : ContentSettingSingleRadioGroup(tab_contents, profile, content_type) { 186 : ContentSettingSingleRadioGroup(tab_contents, profile, content_type) {
186 DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS); 187 DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 ContentSettingBubbleModel::~ContentSettingBubbleModel() { 364 ContentSettingBubbleModel::~ContentSettingBubbleModel() {
364 } 365 }
365 366
366 void ContentSettingBubbleModel::Observe(NotificationType type, 367 void ContentSettingBubbleModel::Observe(NotificationType type,
367 const NotificationSource& source, 368 const NotificationSource& source,
368 const NotificationDetails& details) { 369 const NotificationDetails& details) {
369 DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED); 370 DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED);
370 DCHECK(source == Source<TabContents>(tab_contents_)); 371 DCHECK(source == Source<TabContents>(tab_contents_));
371 tab_contents_ = NULL; 372 tab_contents_ = NULL;
372 } 373 }
OLDNEW
« no previous file with comments | « chrome/browser/content_exceptions_table_model.cc ('k') | chrome/browser/cookie_modal_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698