| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/webui/plugins_ui.h" | 5 #include "chrome/browser/ui/webui/plugins_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/browser/plugin_updater.h" | 16 #include "chrome/browser/plugin_updater.h" |
| 17 #include "chrome/browser/prefs/pref_member.h" | 17 #include "chrome/browser/prefs/pref_member.h" |
| 18 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| 21 #include "chrome/browser/ui/browser_window.h" | 21 #include "chrome/browser/ui/browser_window.h" |
| 22 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 22 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 23 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 23 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| 24 #include "chrome/common/chrome_content_client.h" | 24 #include "chrome/common/chrome_content_client.h" |
| 25 #include "chrome/common/chrome_notification_types.h" |
| 25 #include "chrome/common/chrome_paths.h" | 26 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 27 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
| 28 #include "content/browser/browser_thread.h" | 29 #include "content/browser/browser_thread.h" |
| 29 #include "content/browser/tab_contents/tab_contents.h" | 30 #include "content/browser/tab_contents/tab_contents.h" |
| 30 #include "content/common/notification_service.h" | 31 #include "content/common/notification_service.h" |
| 31 #include "grit/browser_resources.h" | 32 #include "grit/browser_resources.h" |
| 32 #include "grit/generated_resources.h" | 33 #include "grit/generated_resources.h" |
| 33 #include "grit/theme_resources.h" | 34 #include "grit/theme_resources.h" |
| 34 #include "grit/theme_resources_standard.h" | 35 #include "grit/theme_resources_standard.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // This pref guards the value whether about:plugins is in the details mode or | 148 // This pref guards the value whether about:plugins is in the details mode or |
| 148 // not. | 149 // not. |
| 149 BooleanPrefMember show_details_; | 150 BooleanPrefMember show_details_; |
| 150 | 151 |
| 151 DISALLOW_COPY_AND_ASSIGN(PluginsDOMHandler); | 152 DISALLOW_COPY_AND_ASSIGN(PluginsDOMHandler); |
| 152 }; | 153 }; |
| 153 | 154 |
| 154 PluginsDOMHandler::PluginsDOMHandler() | 155 PluginsDOMHandler::PluginsDOMHandler() |
| 155 : ALLOW_THIS_IN_INITIALIZER_LIST(get_plugins_factory_(this)) { | 156 : ALLOW_THIS_IN_INITIALIZER_LIST(get_plugins_factory_(this)) { |
| 156 registrar_.Add(this, | 157 registrar_.Add(this, |
| 157 content::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, | 158 chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, |
| 158 NotificationService::AllSources()); | 159 NotificationService::AllSources()); |
| 159 } | 160 } |
| 160 | 161 |
| 161 WebUIMessageHandler* PluginsDOMHandler::Attach(WebUI* web_ui) { | 162 WebUIMessageHandler* PluginsDOMHandler::Attach(WebUI* web_ui) { |
| 162 PrefService* prefs = web_ui->GetProfile()->GetPrefs(); | 163 PrefService* prefs = web_ui->GetProfile()->GetPrefs(); |
| 163 | 164 |
| 164 show_details_.Init(prefs::kPluginsShowDetails, prefs, this); | 165 show_details_.Init(prefs::kPluginsShowDetails, prefs, this); |
| 165 | 166 |
| 166 return WebUIMessageHandler::Attach(web_ui); | 167 return WebUIMessageHandler::Attach(web_ui); |
| 167 } | 168 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 } | 244 } |
| 244 | 245 |
| 245 void PluginsDOMHandler::HandleGetShowDetails(const ListValue* args) { | 246 void PluginsDOMHandler::HandleGetShowDetails(const ListValue* args) { |
| 246 FundamentalValue show_details(show_details_.GetValue()); | 247 FundamentalValue show_details(show_details_.GetValue()); |
| 247 web_ui_->CallJavascriptFunction("loadShowDetailsFromPrefs", show_details); | 248 web_ui_->CallJavascriptFunction("loadShowDetailsFromPrefs", show_details); |
| 248 } | 249 } |
| 249 | 250 |
| 250 void PluginsDOMHandler::Observe(int type, | 251 void PluginsDOMHandler::Observe(int type, |
| 251 const NotificationSource& source, | 252 const NotificationSource& source, |
| 252 const NotificationDetails& details) { | 253 const NotificationDetails& details) { |
| 253 DCHECK_EQ(content::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, type); | 254 DCHECK_EQ(chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, type); |
| 254 LoadPlugins(); | 255 LoadPlugins(); |
| 255 } | 256 } |
| 256 | 257 |
| 257 void PluginsDOMHandler::LoadPluginsOnFileThread(ListWrapper* wrapper, | 258 void PluginsDOMHandler::LoadPluginsOnFileThread(ListWrapper* wrapper, |
| 258 Task* task) { | 259 Task* task) { |
| 259 wrapper->list = PluginUpdater::GetInstance()->GetPluginGroupsData(); | 260 wrapper->list = PluginUpdater::GetInstance()->GetPluginGroupsData(); |
| 260 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, task); | 261 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, task); |
| 261 BrowserThread::PostTask( | 262 BrowserThread::PostTask( |
| 262 BrowserThread::UI, | 263 BrowserThread::UI, |
| 263 FROM_HERE, | 264 FROM_HERE, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 prefs->RegisterBooleanPref(prefs::kPluginsEnabledInternalPDF, | 328 prefs->RegisterBooleanPref(prefs::kPluginsEnabledInternalPDF, |
| 328 false, | 329 false, |
| 329 PrefService::UNSYNCABLE_PREF); | 330 PrefService::UNSYNCABLE_PREF); |
| 330 prefs->RegisterBooleanPref(prefs::kPluginsShowDetails, | 331 prefs->RegisterBooleanPref(prefs::kPluginsShowDetails, |
| 331 false, | 332 false, |
| 332 PrefService::UNSYNCABLE_PREF); | 333 PrefService::UNSYNCABLE_PREF); |
| 333 prefs->RegisterBooleanPref(prefs::kPluginsShowSetReaderDefaultInfobar, | 334 prefs->RegisterBooleanPref(prefs::kPluginsShowSetReaderDefaultInfobar, |
| 334 true, | 335 true, |
| 335 PrefService::UNSYNCABLE_PREF); | 336 PrefService::UNSYNCABLE_PREF); |
| 336 } | 337 } |
| OLD | NEW |