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/plugin_updater.h" | 5 #include "chrome/browser/plugin_updater.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "base/version.h" | 14 #include "base/version.h" |
15 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
16 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 16 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/common/chrome_content_client.h" |
18 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
19 #include "chrome/common/pepper_plugin_registry.h" | |
20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
21 #include "content/browser/browser_thread.h" | 21 #include "content/browser/browser_thread.h" |
22 #include "content/common/notification_service.h" | 22 #include "content/common/notification_service.h" |
23 #include "webkit/plugins/npapi/plugin_list.h" | 23 #include "webkit/plugins/npapi/plugin_list.h" |
24 #include "webkit/plugins/npapi/webplugininfo.h" | 24 #include "webkit/plugins/npapi/webplugininfo.h" |
25 | 25 |
26 // How long to wait to save the plugin enabled information, which might need to | 26 // How long to wait to save the plugin enabled information, which might need to |
27 // go to disk. | 27 // go to disk. |
28 #define kPluginUpdateDelayMs (60 * 1000) | 28 #define kPluginUpdateDelayMs (60 * 1000) |
29 | 29 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 FilePath cur_internal_dir; | 134 FilePath cur_internal_dir; |
135 if (PathService::Get(chrome::DIR_INTERNAL_PLUGINS, &cur_internal_dir) && | 135 if (PathService::Get(chrome::DIR_INTERNAL_PLUGINS, &cur_internal_dir) && |
136 cur_internal_dir != last_internal_dir) { | 136 cur_internal_dir != last_internal_dir) { |
137 update_internal_dir = true; | 137 update_internal_dir = true; |
138 profile->GetPrefs()->SetFilePath( | 138 profile->GetPrefs()->SetFilePath( |
139 prefs::kPluginsLastInternalDirectory, cur_internal_dir); | 139 prefs::kPluginsLastInternalDirectory, cur_internal_dir); |
140 } | 140 } |
141 | 141 |
142 bool force_enable_internal_pdf = false; | 142 bool force_enable_internal_pdf = false; |
143 bool internal_pdf_enabled = false; | 143 bool internal_pdf_enabled = false; |
144 string16 pdf_group_name = ASCIIToUTF16(PepperPluginRegistry::kPDFPluginName); | 144 string16 pdf_group_name = |
| 145 ASCIIToUTF16(chrome::ChromeContentClient::kPDFPluginName); |
145 FilePath pdf_path; | 146 FilePath pdf_path; |
146 PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path); | 147 PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path); |
147 FilePath::StringType pdf_path_str = pdf_path.value(); | 148 FilePath::StringType pdf_path_str = pdf_path.value(); |
148 if (!profile->GetPrefs()->GetBoolean(prefs::kPluginsEnabledInternalPDF)) { | 149 if (!profile->GetPrefs()->GetBoolean(prefs::kPluginsEnabledInternalPDF)) { |
149 // We switched to the internal pdf plugin being on by default, and so we | 150 // We switched to the internal pdf plugin being on by default, and so we |
150 // need to force it to be enabled. We only want to do it this once though, | 151 // need to force it to be enabled. We only want to do it this once though, |
151 // i.e. we don't want to enable it again if the user disables it afterwards. | 152 // i.e. we don't want to enable it again if the user disables it afterwards. |
152 profile->GetPrefs()->SetBoolean(prefs::kPluginsEnabledInternalPDF, true); | 153 profile->GetPrefs()->SetBoolean(prefs::kPluginsEnabledInternalPDF, true); |
153 force_enable_internal_pdf = true; | 154 force_enable_internal_pdf = true; |
154 } | 155 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 NotificationService::current()->Notify( | 316 NotificationService::current()->Notify( |
316 NotificationType::PLUGIN_ENABLE_STATUS_CHANGED, | 317 NotificationType::PLUGIN_ENABLE_STATUS_CHANGED, |
317 Source<PluginUpdater>(GetInstance()), | 318 Source<PluginUpdater>(GetInstance()), |
318 NotificationService::NoDetails()); | 319 NotificationService::NoDetails()); |
319 } | 320 } |
320 | 321 |
321 /*static*/ | 322 /*static*/ |
322 PluginUpdater* PluginUpdater::GetInstance() { | 323 PluginUpdater* PluginUpdater::GetInstance() { |
323 return Singleton<PluginUpdater>::get(); | 324 return Singleton<PluginUpdater>::get(); |
324 } | 325 } |
OLD | NEW |