OLD | NEW |
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 "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/blocked_content_container.h" | 10 #include "chrome/browser/blocked_content_container.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 public: | 290 public: |
291 ContentSettingPluginBubbleModel(TabContents* tab_contents, Profile* profile, | 291 ContentSettingPluginBubbleModel(TabContents* tab_contents, Profile* profile, |
292 ContentSettingsType content_type) | 292 ContentSettingsType content_type) |
293 : ContentSettingSingleRadioGroup(tab_contents, profile, content_type) { | 293 : ContentSettingSingleRadioGroup(tab_contents, profile, content_type) { |
294 DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS); | 294 DCHECK_EQ(content_type, CONTENT_SETTINGS_TYPE_PLUGINS); |
295 SetLoadPluginsLinkTitle(); | 295 SetLoadPluginsLinkTitle(); |
296 } | 296 } |
297 | 297 |
298 private: | 298 private: |
299 void SetLoadPluginsLinkTitle() { | 299 void SetLoadPluginsLinkTitle() { |
300 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 300 set_load_plugins_link_title( |
301 switches::kDisableClickToPlay)) { | 301 l10n_util::GetStringUTF8(IDS_BLOCKED_PLUGINS_LOAD_ALL)); |
302 set_load_plugins_link_title( | |
303 l10n_util::GetStringUTF8(IDS_BLOCKED_PLUGINS_LOAD_ALL)); | |
304 } | |
305 } | 302 } |
306 | 303 |
307 virtual void OnLoadPluginsLinkClicked() { | 304 virtual void OnLoadPluginsLinkClicked() { |
308 DCHECK(!CommandLine::ForCurrentProcess()->HasSwitch( | |
309 switches::kDisableClickToPlay)); | |
310 UserMetrics::RecordAction(UserMetricsAction("ClickToPlay_LoadAll_Bubble")); | 305 UserMetrics::RecordAction(UserMetricsAction("ClickToPlay_LoadAll_Bubble")); |
311 if (tab_contents()) { | 306 if (tab_contents()) { |
312 tab_contents()->render_view_host()->LoadBlockedPlugins(); | 307 tab_contents()->render_view_host()->LoadBlockedPlugins(); |
313 } | 308 } |
314 set_load_plugins_link_enabled(false); | 309 set_load_plugins_link_enabled(false); |
315 TabSpecificContentSettings* settings = | 310 TabSpecificContentSettings* settings = |
316 tab_contents()->GetTabSpecificContentSettings(); | 311 tab_contents()->GetTabSpecificContentSettings(); |
317 settings->set_load_plugins_link_enabled(false); | 312 settings->set_load_plugins_link_enabled(false); |
318 } | 313 } |
319 }; | 314 }; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 bubble_content_.resource_identifiers.insert(resource_identifier); | 474 bubble_content_.resource_identifiers.insert(resource_identifier); |
480 } | 475 } |
481 | 476 |
482 void ContentSettingBubbleModel::Observe(NotificationType type, | 477 void ContentSettingBubbleModel::Observe(NotificationType type, |
483 const NotificationSource& source, | 478 const NotificationSource& source, |
484 const NotificationDetails& details) { | 479 const NotificationDetails& details) { |
485 DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED); | 480 DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED); |
486 DCHECK(source == Source<TabContents>(tab_contents_)); | 481 DCHECK(source == Source<TabContents>(tab_contents_)); |
487 tab_contents_ = NULL; | 482 tab_contents_ = NULL; |
488 } | 483 } |
OLD | NEW |