| Index: chrome/browser/plugin_database_handler.h
|
| diff --git a/chrome/default_plugin/plugin_database_handler.h b/chrome/browser/plugin_database_handler.h
|
| similarity index 73%
|
| rename from chrome/default_plugin/plugin_database_handler.h
|
| rename to chrome/browser/plugin_database_handler.h
|
| index 1f127457e79fe53bdf4001bc0c9ecf0f906cc3ce..a2ffce45d89be8e11e0cbfbb4a8e5e19f464f02c 100644
|
| --- a/chrome/default_plugin/plugin_database_handler.h
|
| +++ b/chrome/browser/plugin_database_handler.h
|
| @@ -1,36 +1,18 @@
|
| -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CHROME_DEFAULT_PLUGIN_PLUGIN_DATABASE_HANDLER_H_
|
| -#define CHROME_DEFAULT_PLUGIN_PLUGIN_DATABASE_HANDLER_H_
|
| +#ifndef CHROME_BROWSER_PLUGIN_DATABASE_HANDLER_H_
|
| +#define CHROME_BROWSER_PLUGIN_DATABASE_HANDLER_H_
|
| #pragma once
|
|
|
| -#include <windows.h>
|
| #include <string>
|
| #include <vector>
|
|
|
| #include "base/basictypes.h"
|
| +#include "base/platform_file.h"
|
| #include "third_party/npapi/bindings/npapi.h"
|
|
|
| -// Individual plugin details
|
| -struct PluginDetail {
|
| - // List of mime types supported by the plugin.
|
| - std::vector<std::string> mime_types;
|
| - // The URL where the plugin can be downloaded from.
|
| - std::string download_url;
|
| - // The display name for the plugin.
|
| - std::wstring display_name;
|
| - // Language of the plugin installer. (en-us, etc).
|
| - std::string language;
|
| - // Indicates if the download URL points to an exe or to a URL which
|
| - // needs to be displayed in a tab.
|
| - bool download_url_for_display;
|
| -};
|
| -
|
| -typedef std::vector<PluginDetail> PluginList;
|
| -
|
| -class PluginInstallerImpl;
|
| struct _xmlNode;
|
|
|
| // This class handles download of the plugins database file from the plugin
|
| @@ -50,12 +32,17 @@ struct _xmlNode;
|
| // </plugins>
|
| class PluginDatabaseHandler {
|
| public:
|
| + class Client {
|
| + public:
|
| + virtual void DownloadPluginList(const std::string& plugin_finder_url) = 0;
|
| + virtual void OnPluginListDownloaded() = 0;
|
| + };
|
| +
|
| // plugin_installer_instance is a reference maintained to the current
|
| // PluginInstallerImpl instance.
|
| - explicit PluginDatabaseHandler(
|
| - PluginInstallerImpl& plugin_installer_instance);
|
| + explicit PluginDatabaseHandler();
|
|
|
| - virtual ~PluginDatabaseHandler();
|
| + ~PluginDatabaseHandler();
|
|
|
| // Downloads the plugins database file if needed.
|
| //
|
| @@ -63,7 +50,8 @@ class PluginDatabaseHandler {
|
| // plugin_finder_url
|
| // Specifies the http/https location of the chrome plugin finder.
|
| // Returns true on success.
|
| - bool DownloadPluginsFileIfNeeded(const std::string& plugin_finder_url);
|
| + bool DownloadPluginsFileIfNeeded(const std::string& plugin_finder_url,
|
| + Client* client);
|
|
|
| // Writes data to the plugins database file.
|
| //
|
| @@ -80,7 +68,7 @@ class PluginDatabaseHandler {
|
| int32 Write(NPStream* stream, int32 offset, int32 buffer_length,
|
| void* buffer);
|
|
|
| - const std::wstring& plugins_file() const {
|
| + const FilePath& plugins_file() const {
|
| return plugins_file_;
|
| }
|
|
|
| @@ -105,10 +93,10 @@ class PluginDatabaseHandler {
|
| // Output parameter which indicates if the plugin URL points to an exe
|
| // or not.
|
| // Returns true if the plugin details were found.
|
| - bool GetPluginDetailsForMimeType(const char* mime_type,
|
| - const char* language,
|
| + bool GetPluginDetailsForMimeType(const std::string& mime_type,
|
| + const std::string& language,
|
| std::string* download_url,
|
| - std::wstring* display_name,
|
| + string16* display_name,
|
| bool* download_url_for_display);
|
|
|
| // Closes the handle to the plugin database file.
|
| @@ -119,6 +107,24 @@ class PluginDatabaseHandler {
|
| void Close(bool delete_file);
|
|
|
| protected:
|
| + // Individual plugin details
|
| + struct PluginDetail {
|
| + PluginDetail();
|
| + ~PluginDetail();
|
| +
|
| + // List of mime types supported by the plugin.
|
| + std::vector<std::string> mime_types;
|
| + // The URL where the plugin can be downloaded from.
|
| + std::string download_url;
|
| + // The display name for the plugin.
|
| + string16 display_name;
|
| + // Language of the plugin installer. (en-us, etc).
|
| + std::string language;
|
| + // Indicates if the download URL points to an exe or to a URL which
|
| + // needs to be displayed in a tab.
|
| + bool download_url_for_display;
|
| + };
|
| +
|
| // Reads plugin information off an individual XML node.
|
| //
|
| // Parameters:
|
| @@ -130,20 +136,18 @@ class PluginDatabaseHandler {
|
| bool ReadPluginInfo(_xmlNode* plugin_node, PluginDetail* plugin_detail);
|
|
|
| private:
|
| + typedef std::vector<PluginDetail> PluginList;
|
| +
|
| // Contains the full path of the downloaded plugins file containing
|
| // information about available third party plugin downloads.
|
| - std::wstring plugins_file_;
|
| + FilePath plugins_file_;
|
| // Handle to the downloaded plugins file.
|
| - HANDLE plugin_downloads_file_;
|
| + base::PlatformFile plugin_downloads_file_;
|
| // List of downloaded plugins. This is generated the first time the
|
| // plugins file is downloaded and parsed. Each item in the list is
|
| // of the type PluginDetail, and contains information about the third
|
| // party plugin like it's mime type, download link, etc.
|
| PluginList downloaded_plugins_list_;
|
| - // We maintain a reference to the PluginInstallerImpl instance to be able
|
| - // to achieve plugin installer state changes and to notify the instance
|
| - // about download completions.
|
| - PluginInstallerImpl& plugin_installer_instance_;
|
| // The plugin finder url
|
| std::string plugin_finder_url_;
|
| // Set if the current instance should ignore plugin data. This is required
|
| @@ -154,4 +158,4 @@ class PluginDatabaseHandler {
|
| bool ignore_plugin_db_data_;
|
| };
|
|
|
| -#endif // CHROME_DEFAULT_PLUGIN_PLUGIN_DATABASE_HANDLER_H_
|
| +#endif // CHROME_BROWSER_PLUGIN_DATABASE_HANDLER_H_
|
|
|