| 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 #ifndef CHROME_BROWSER_PLUGIN_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_PLUGIN_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_PLUGIN_OBSERVER_H_ | 6 #define CHROME_BROWSER_PLUGIN_OBSERVER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "content/browser/tab_contents/tab_contents_observer.h" | 10 #include "content/browser/tab_contents/tab_contents_observer.h" |
| 11 | 11 |
| 12 class GURL; | 12 class GURL; |
| 13 class InfoBarDelegate; | 13 class InfoBarDelegate; |
| 14 class PluginInstaller; |
| 14 class TabContentsWrapper; | 15 class TabContentsWrapper; |
| 15 | 16 |
| 16 class PluginObserver : public TabContentsObserver { | 17 class PluginObserver : public TabContentsObserver { |
| 17 public: | 18 public: |
| 18 explicit PluginObserver(TabContentsWrapper* tab_contents); | 19 explicit PluginObserver(TabContentsWrapper* tab_contents); |
| 19 virtual ~PluginObserver(); | 20 virtual ~PluginObserver(); |
| 20 | 21 |
| 21 // IPC::Channel::Listener implementation. | 22 // IPC::Channel::Listener implementation. |
| 22 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 23 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 23 | 24 |
| 24 private: | 25 private: |
| 25 void OnBlockedOutdatedPlugin(const string16& name, const GURL& update_url); | 26 void OnBlockedOutdatedPlugin(const string16& name, const GURL& update_url); |
| 26 void OnFindMissingPlugin(int placeholder_id, const std::string& mime_type); | 27 void OnFindMissingPlugin(int placeholder_id, const std::string& mime_type); |
| 27 | 28 |
| 28 void FoundMissingPlugin(int placeholder_id, | 29 void FoundMissingPlugin(int placeholder_id, |
| 29 const std::string& mime_type, | 30 const std::string& mime_type, |
| 30 const GURL& url, | 31 PluginInstaller* installer); |
| 31 const string16& name, | |
| 32 bool display_url); | |
| 33 void DidNotFindMissingPlugin(int placeholder_id, | 32 void DidNotFindMissingPlugin(int placeholder_id, |
| 34 const std::string& mime_type); | 33 const std::string& mime_type); |
| 35 void InstallMissingPlugin(const GURL& url, bool display_url); | 34 void InstallMissingPlugin(PluginInstaller* installer); |
| 36 | 35 |
| 37 base::WeakPtrFactory<PluginObserver> weak_ptr_factory_; | 36 base::WeakPtrFactory<PluginObserver> weak_ptr_factory_; |
| 38 | 37 |
| 39 TabContentsWrapper* tab_contents_; | 38 TabContentsWrapper* tab_contents_; |
| 40 scoped_ptr<InfoBarDelegate> plugin_installer_; // Lazily created. | |
| 41 | 39 |
| 42 DISALLOW_COPY_AND_ASSIGN(PluginObserver); | 40 DISALLOW_COPY_AND_ASSIGN(PluginObserver); |
| 43 }; | 41 }; |
| 44 | 42 |
| 45 #endif // CHROME_BROWSER_PLUGIN_OBSERVER_H_ | 43 #endif // CHROME_BROWSER_PLUGIN_OBSERVER_H_ |
| OLD | NEW |