| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/plugins/plugin_finder.h" | 5 #include "chrome/browser/plugins/plugin_finder.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "base/sys_string_conversions.h" | 11 #include "base/sys_string_conversions.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 "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/plugins/plugin_installer.h" | 15 #include "chrome/browser/plugins/plugin_metadata.h" |
| 16 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
| 17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 19 #include "content/public/browser/plugin_service.h" | 19 #include "content/public/browser/plugin_service.h" |
| 20 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
| 21 #include "grit/browser_resources.h" | 21 #include "grit/browser_resources.h" |
| 22 #include "ui/base/layout.h" | 22 #include "ui/base/layout.h" |
| 23 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| 24 | 24 |
| 25 #if defined(ENABLE_PLUGIN_INSTALLATION) | 25 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 49 FilePath::StringType path = plugin.path.BaseName().RemoveExtension().value(); | 49 FilePath::StringType path = plugin.path.BaseName().RemoveExtension().value(); |
| 50 #if defined(OS_POSIX) | 50 #if defined(OS_POSIX) |
| 51 return UTF8ToUTF16(path); | 51 return UTF8ToUTF16(path); |
| 52 #elif defined(OS_WIN) | 52 #elif defined(OS_WIN) |
| 53 return WideToUTF16(path); | 53 return WideToUTF16(path); |
| 54 #endif | 54 #endif |
| 55 } | 55 } |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| 58 | 58 |
| 59 // TODO(ibraaaa): DELETE. http://crbug.com/124396 | |
| 60 // static | |
| 61 void PluginFinder::Get(const base::Callback<void(PluginFinder*)>& cb) { | |
| 62 // At a later point we might want to do intialization here that needs to be | |
| 63 // done asynchronously, like loading the plug-in list from disk or from a URL. | |
| 64 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(cb, GetInstance())); | |
| 65 } | |
| 66 | |
| 67 // static | 59 // static |
| 68 PluginFinder* PluginFinder::GetInstance() { | 60 PluginFinder* PluginFinder::GetInstance() { |
| 69 // PluginFinder::GetInstance() is the only method that's allowed to call | 61 // PluginFinder::GetInstance() is the only method that's allowed to call |
| 70 // Singleton<PluginFinder>::get(). | 62 // Singleton<PluginFinder>::get(). |
| 71 return Singleton<PluginFinder>::get(); | 63 return Singleton<PluginFinder>::get(); |
| 72 } | 64 } |
| 73 | 65 |
| 74 PluginFinder::PluginFinder() { | 66 PluginFinder::PluginFinder() { |
| 75 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 67 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 76 } | 68 } |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 std::string identifier = GetIdentifier(plugin); | 254 std::string identifier = GetIdentifier(plugin); |
| 263 PluginMetadata* metadata = new PluginMetadata(identifier, | 255 PluginMetadata* metadata = new PluginMetadata(identifier, |
| 264 GetGroupName(plugin), | 256 GetGroupName(plugin), |
| 265 false, GURL(), GURL(), | 257 false, GURL(), GURL(), |
| 266 GetGroupName(plugin)); | 258 GetGroupName(plugin)); |
| 267 | 259 |
| 268 name_plugin_[plugin.name] = metadata; | 260 name_plugin_[plugin.name] = metadata; |
| 269 identifier_plugin_[identifier] = metadata; | 261 identifier_plugin_[identifier] = metadata; |
| 270 return metadata; | 262 return metadata; |
| 271 } | 263 } |
| OLD | NEW |