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 = Profile::FromWebUI(web_ui)->GetPrefs(); | 159 PrefService* prefs = Profile::FromWebUI(web_ui)->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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 242 } |
242 | 243 |
243 void PluginsDOMHandler::HandleGetShowDetails(const ListValue* args) { | 244 void PluginsDOMHandler::HandleGetShowDetails(const ListValue* args) { |
244 base::FundamentalValue show_details(show_details_.GetValue()); | 245 base::FundamentalValue show_details(show_details_.GetValue()); |
245 web_ui_->CallJavascriptFunction("loadShowDetailsFromPrefs", show_details); | 246 web_ui_->CallJavascriptFunction("loadShowDetailsFromPrefs", show_details); |
246 } | 247 } |
247 | 248 |
248 void PluginsDOMHandler::Observe(int type, | 249 void PluginsDOMHandler::Observe(int type, |
249 const NotificationSource& source, | 250 const NotificationSource& source, |
250 const NotificationDetails& details) { | 251 const NotificationDetails& details) { |
251 DCHECK_EQ(content::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, type); | 252 DCHECK_EQ(chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, type); |
252 LoadPlugins(); | 253 LoadPlugins(); |
253 } | 254 } |
254 | 255 |
255 void PluginsDOMHandler::LoadPluginsOnFileThread( | 256 void PluginsDOMHandler::LoadPluginsOnFileThread( |
256 std::vector<webkit::npapi::PluginGroup>* groups, | 257 std::vector<webkit::npapi::PluginGroup>* groups, |
257 Task* task) { | 258 Task* task) { |
258 webkit::npapi::PluginList::Singleton()->GetPluginGroups(true, groups); | 259 webkit::npapi::PluginList::Singleton()->GetPluginGroups(true, groups); |
259 | 260 |
260 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, task); | 261 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, task); |
261 BrowserThread::PostTask( | 262 BrowserThread::PostTask( |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 prefs->RegisterBooleanPref(prefs::kPluginsEnabledNaCl, | 338 prefs->RegisterBooleanPref(prefs::kPluginsEnabledNaCl, |
338 false, | 339 false, |
339 PrefService::UNSYNCABLE_PREF); | 340 PrefService::UNSYNCABLE_PREF); |
340 prefs->RegisterBooleanPref(prefs::kPluginsShowDetails, | 341 prefs->RegisterBooleanPref(prefs::kPluginsShowDetails, |
341 false, | 342 false, |
342 PrefService::UNSYNCABLE_PREF); | 343 PrefService::UNSYNCABLE_PREF); |
343 prefs->RegisterBooleanPref(prefs::kPluginsShowSetReaderDefaultInfobar, | 344 prefs->RegisterBooleanPref(prefs::kPluginsShowSetReaderDefaultInfobar, |
344 true, | 345 true, |
345 PrefService::UNSYNCABLE_PREF); | 346 PrefService::UNSYNCABLE_PREF); |
346 } | 347 } |
OLD | NEW |