| 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 #ifndef PPAPI_PROXY_PLUGIN_GLOBALS_H_ | 5 #ifndef PPAPI_PROXY_PLUGIN_GLOBALS_H_ |
| 6 #define PPAPI_PROXY_PLUGIN_GLOBALS_H_ | 6 #define PPAPI_PROXY_PLUGIN_GLOBALS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 virtual void LogWithSource(PP_Instance instance, | 66 virtual void LogWithSource(PP_Instance instance, |
| 67 PP_LogLevel level, | 67 PP_LogLevel level, |
| 68 const std::string& source, | 68 const std::string& source, |
| 69 const std::string& value) OVERRIDE; | 69 const std::string& value) OVERRIDE; |
| 70 virtual void BroadcastLogWithSource(PP_Module module, | 70 virtual void BroadcastLogWithSource(PP_Module module, |
| 71 PP_LogLevel level, | 71 PP_LogLevel level, |
| 72 const std::string& source, | 72 const std::string& source, |
| 73 const std::string& value) OVERRIDE; | 73 const std::string& value) OVERRIDE; |
| 74 virtual MessageLoopShared* GetCurrentMessageLoop() OVERRIDE; | 74 virtual MessageLoopShared* GetCurrentMessageLoop() OVERRIDE; |
| 75 base::TaskRunner* GetFileTaskRunner() OVERRIDE; | 75 base::TaskRunner* GetFileTaskRunner() OVERRIDE; |
| 76 virtual void MarkPluginIsActive() OVERRIDE; |
| 76 | 77 |
| 77 // Returns the channel for sending to the browser. | 78 // Returns the channel for sending to the browser. |
| 78 IPC::Sender* GetBrowserSender(); | 79 IPC::Sender* GetBrowserSender(); |
| 79 | 80 |
| 80 // Returns the language code of the current UI language. | 81 // Returns the language code of the current UI language. |
| 81 std::string GetUILanguage(); | 82 std::string GetUILanguage(); |
| 82 | 83 |
| 83 // Sets the active url which is reported by breakpad. | 84 // Sets the active url which is reported by breakpad. |
| 84 void SetActiveURL(const std::string& url); | 85 void SetActiveURL(const std::string& url); |
| 85 | 86 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // long as the plugin. | 122 // long as the plugin. |
| 122 MessageLoopResource* loop_for_main_thread(); | 123 MessageLoopResource* loop_for_main_thread(); |
| 123 | 124 |
| 124 // The embedder should call this function when the name of the plugin module | 125 // The embedder should call this function when the name of the plugin module |
| 125 // is known. This will be used for error logging. | 126 // is known. This will be used for error logging. |
| 126 void set_plugin_name(const std::string& name) { plugin_name_ = name; } | 127 void set_plugin_name(const std::string& name) { plugin_name_ = name; } |
| 127 | 128 |
| 128 // The embedder should call this function when the command line is known. | 129 // The embedder should call this function when the command line is known. |
| 129 void set_command_line(const std::string& c) { command_line_ = c; } | 130 void set_command_line(const std::string& c) { command_line_ = c; } |
| 130 | 131 |
| 132 bool plugin_has_been_active() const { return plugin_has_been_active_; } |
| 133 void set_plugin_has_been_active(bool b) { plugin_has_been_active_ = b; } |
| 134 |
| 131 private: | 135 private: |
| 132 class BrowserSender; | 136 class BrowserSender; |
| 133 | 137 |
| 134 // PpapiGlobals overrides. | 138 // PpapiGlobals overrides. |
| 135 virtual bool IsPluginGlobals() const OVERRIDE; | 139 virtual bool IsPluginGlobals() const OVERRIDE; |
| 136 | 140 |
| 137 static PluginGlobals* plugin_globals_; | 141 static PluginGlobals* plugin_globals_; |
| 138 | 142 |
| 139 PluginProxyDelegate* plugin_proxy_delegate_; | 143 PluginProxyDelegate* plugin_proxy_delegate_; |
| 140 PluginResourceTracker plugin_resource_tracker_; | 144 PluginResourceTracker plugin_resource_tracker_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 153 // Command line for the plugin. This will be empty until set_command_line is | 157 // Command line for the plugin. This will be empty until set_command_line is |
| 154 // called. | 158 // called. |
| 155 std::string command_line_; | 159 std::string command_line_; |
| 156 | 160 |
| 157 scoped_ptr<BrowserSender> browser_sender_; | 161 scoped_ptr<BrowserSender> browser_sender_; |
| 158 | 162 |
| 159 // Thread for performing potentially blocking file operations. It's created | 163 // Thread for performing potentially blocking file operations. It's created |
| 160 // lazily, since it might not be needed. | 164 // lazily, since it might not be needed. |
| 161 scoped_ptr<base::Thread> file_thread_; | 165 scoped_ptr<base::Thread> file_thread_; |
| 162 | 166 |
| 167 // Indicates activity by the plugin. Used to monitor when a plugin can be |
| 168 // shutdown due to idleness. Current needs do not require differentiating |
| 169 // between idle state between multiple instances, if any are active they are |
| 170 // all considered active. |
| 171 bool plugin_has_been_active_; |
| 172 |
| 163 DISALLOW_COPY_AND_ASSIGN(PluginGlobals); | 173 DISALLOW_COPY_AND_ASSIGN(PluginGlobals); |
| 164 }; | 174 }; |
| 165 | 175 |
| 166 } // namespace proxy | 176 } // namespace proxy |
| 167 } // namespace ppapi | 177 } // namespace ppapi |
| 168 | 178 |
| 169 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_ | 179 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_ |
| OLD | NEW |