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_prefs.h" | 16 #include "chrome/browser/plugin_prefs.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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // This pref guards the value whether about:plugins is in the details mode or | 144 // This pref guards the value whether about:plugins is in the details mode or |
144 // not. | 145 // not. |
145 BooleanPrefMember show_details_; | 146 BooleanPrefMember show_details_; |
146 | 147 |
147 DISALLOW_COPY_AND_ASSIGN(PluginsDOMHandler); | 148 DISALLOW_COPY_AND_ASSIGN(PluginsDOMHandler); |
148 }; | 149 }; |
149 | 150 |
150 PluginsDOMHandler::PluginsDOMHandler() | 151 PluginsDOMHandler::PluginsDOMHandler() |
151 : ALLOW_THIS_IN_INITIALIZER_LIST(get_plugins_factory_(this)) { | 152 : ALLOW_THIS_IN_INITIALIZER_LIST(get_plugins_factory_(this)) { |
152 registrar_.Add(this, | 153 registrar_.Add(this, |
153 content::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, | 154 chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, |
154 NotificationService::AllSources()); | 155 NotificationService::AllSources()); |
155 } | 156 } |
156 | 157 |
157 WebUIMessageHandler* PluginsDOMHandler::Attach(WebUI* web_ui) { | 158 WebUIMessageHandler* PluginsDOMHandler::Attach(WebUI* web_ui) { |
158 PrefService* prefs = web_ui->GetProfile()->GetPrefs(); | 159 PrefService* prefs = web_ui->GetProfile()->GetPrefs(); |
159 | 160 |
160 show_details_.Init(prefs::kPluginsShowDetails, prefs, NULL); | 161 show_details_.Init(prefs::kPluginsShowDetails, prefs, NULL); |
161 | 162 |
162 return WebUIMessageHandler::Attach(web_ui); | 163 return WebUIMessageHandler::Attach(web_ui); |
163 } | 164 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 240 } |
240 | 241 |
241 void PluginsDOMHandler::HandleGetShowDetails(const ListValue* args) { | 242 void PluginsDOMHandler::HandleGetShowDetails(const ListValue* args) { |
242 FundamentalValue show_details(show_details_.GetValue()); | 243 FundamentalValue show_details(show_details_.GetValue()); |
243 web_ui_->CallJavascriptFunction("loadShowDetailsFromPrefs", show_details); | 244 web_ui_->CallJavascriptFunction("loadShowDetailsFromPrefs", show_details); |
244 } | 245 } |
245 | 246 |
246 void PluginsDOMHandler::Observe(int type, | 247 void PluginsDOMHandler::Observe(int type, |
247 const NotificationSource& source, | 248 const NotificationSource& source, |
248 const NotificationDetails& details) { | 249 const NotificationDetails& details) { |
249 DCHECK_EQ(content::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, type); | 250 DCHECK_EQ(chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, type); |
250 LoadPlugins(); | 251 LoadPlugins(); |
251 } | 252 } |
252 | 253 |
253 void PluginsDOMHandler::LoadPluginsOnFileThread( | 254 void PluginsDOMHandler::LoadPluginsOnFileThread( |
254 std::vector<webkit::npapi::PluginGroup>* groups, | 255 std::vector<webkit::npapi::PluginGroup>* groups, |
255 Task* task) { | 256 Task* task) { |
256 webkit::npapi::PluginList::Singleton()->GetPluginGroups(true, groups); | 257 webkit::npapi::PluginList::Singleton()->GetPluginGroups(true, groups); |
257 | 258 |
258 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, task); | 259 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, task); |
259 BrowserThread::PostTask( | 260 BrowserThread::PostTask( |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 prefs->RegisterBooleanPref(prefs::kPluginsEnabledInternalPDF, | 333 prefs->RegisterBooleanPref(prefs::kPluginsEnabledInternalPDF, |
333 false, | 334 false, |
334 PrefService::UNSYNCABLE_PREF); | 335 PrefService::UNSYNCABLE_PREF); |
335 prefs->RegisterBooleanPref(prefs::kPluginsShowDetails, | 336 prefs->RegisterBooleanPref(prefs::kPluginsShowDetails, |
336 false, | 337 false, |
337 PrefService::UNSYNCABLE_PREF); | 338 PrefService::UNSYNCABLE_PREF); |
338 prefs->RegisterBooleanPref(prefs::kPluginsShowSetReaderDefaultInfobar, | 339 prefs->RegisterBooleanPref(prefs::kPluginsShowSetReaderDefaultInfobar, |
339 true, | 340 true, |
340 PrefService::UNSYNCABLE_PREF); | 341 PrefService::UNSYNCABLE_PREF); |
341 } | 342 } |
OLD | NEW |