OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_EXTENSIONS_API_RUNTIME_CHROME_RUNTIME_API_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_RUNTIME_CHROME_RUNTIME_API_DELEGATE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_RUNTIME_CHROME_RUNTIME_API_DELEGATE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_RUNTIME_CHROME_RUNTIME_API_DELEGATE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 class ChromeRuntimeAPIDelegate : public extensions::RuntimeAPIDelegate, | 32 class ChromeRuntimeAPIDelegate : public extensions::RuntimeAPIDelegate, |
33 public content::NotificationObserver { | 33 public content::NotificationObserver { |
34 public: | 34 public: |
35 explicit ChromeRuntimeAPIDelegate(content::BrowserContext* context); | 35 explicit ChromeRuntimeAPIDelegate(content::BrowserContext* context); |
36 virtual ~ChromeRuntimeAPIDelegate(); | 36 virtual ~ChromeRuntimeAPIDelegate(); |
37 | 37 |
38 private: | 38 private: |
39 friend class extensions::RuntimeAPI; | 39 friend class extensions::RuntimeAPI; |
40 | 40 |
41 // extensions::RuntimeAPIDelegate implementation. | 41 // extensions::RuntimeAPIDelegate implementation. |
42 virtual void AddUpdateObserver(extensions::UpdateObserver* observer) OVERRIDE; | 42 virtual void AddUpdateObserver(extensions::UpdateObserver* observer) override; |
43 virtual void RemoveUpdateObserver( | 43 virtual void RemoveUpdateObserver( |
44 extensions::UpdateObserver* observer) OVERRIDE; | 44 extensions::UpdateObserver* observer) override; |
45 virtual base::Version GetPreviousExtensionVersion( | 45 virtual base::Version GetPreviousExtensionVersion( |
46 const extensions::Extension* extension) OVERRIDE; | 46 const extensions::Extension* extension) override; |
47 virtual void ReloadExtension(const std::string& extension_id) OVERRIDE; | 47 virtual void ReloadExtension(const std::string& extension_id) override; |
48 virtual bool CheckForUpdates(const std::string& extension_id, | 48 virtual bool CheckForUpdates(const std::string& extension_id, |
49 const UpdateCheckCallback& callback) OVERRIDE; | 49 const UpdateCheckCallback& callback) override; |
50 virtual void OpenURL(const GURL& uninstall_url) OVERRIDE; | 50 virtual void OpenURL(const GURL& uninstall_url) override; |
51 virtual bool GetPlatformInfo( | 51 virtual bool GetPlatformInfo( |
52 extensions::core_api::runtime::PlatformInfo* info) OVERRIDE; | 52 extensions::core_api::runtime::PlatformInfo* info) override; |
53 virtual bool RestartDevice(std::string* error_message) OVERRIDE; | 53 virtual bool RestartDevice(std::string* error_message) override; |
54 | 54 |
55 // content::NotificationObserver implementation. | 55 // content::NotificationObserver implementation. |
56 virtual void Observe(int type, | 56 virtual void Observe(int type, |
57 const content::NotificationSource& source, | 57 const content::NotificationSource& source, |
58 const content::NotificationDetails& details) OVERRIDE; | 58 const content::NotificationDetails& details) override; |
59 | 59 |
60 void UpdateCheckComplete(const std::string& extension_id); | 60 void UpdateCheckComplete(const std::string& extension_id); |
61 void CallUpdateCallbacks(const std::string& extension_id, | 61 void CallUpdateCallbacks(const std::string& extension_id, |
62 const UpdateCheckResult& result); | 62 const UpdateCheckResult& result); |
63 | 63 |
64 content::BrowserContext* browser_context_; | 64 content::BrowserContext* browser_context_; |
65 | 65 |
66 content::NotificationRegistrar registrar_; | 66 content::NotificationRegistrar registrar_; |
67 | 67 |
68 // Whether the API registered with the ExtensionService to receive | 68 // Whether the API registered with the ExtensionService to receive |
69 // update notifications. | 69 // update notifications. |
70 bool registered_for_updates_; | 70 bool registered_for_updates_; |
71 | 71 |
72 // Map to prevent extensions from getting stuck in reload loops. Maps | 72 // Map to prevent extensions from getting stuck in reload loops. Maps |
73 // extension id to the last time it was reloaded and the number of times | 73 // extension id to the last time it was reloaded and the number of times |
74 // it was reloaded with not enough time in between reloads. | 74 // it was reloaded with not enough time in between reloads. |
75 std::map<std::string, std::pair<base::TimeTicks, int> > last_reload_time_; | 75 std::map<std::string, std::pair<base::TimeTicks, int> > last_reload_time_; |
76 | 76 |
77 // Pending update checks. | 77 // Pending update checks. |
78 typedef std::vector<UpdateCheckCallback> UpdateCallbackList; | 78 typedef std::vector<UpdateCheckCallback> UpdateCallbackList; |
79 typedef std::map<std::string, UpdateCallbackList> UpdateCallbackMap; | 79 typedef std::map<std::string, UpdateCallbackList> UpdateCallbackMap; |
80 UpdateCallbackMap pending_update_checks_; | 80 UpdateCallbackMap pending_update_checks_; |
81 | 81 |
82 private: | 82 private: |
83 DISALLOW_COPY_AND_ASSIGN(ChromeRuntimeAPIDelegate); | 83 DISALLOW_COPY_AND_ASSIGN(ChromeRuntimeAPIDelegate); |
84 }; | 84 }; |
85 | 85 |
86 #endif // CHROME_BROWSER_EXTENSIONS_API_RUNTIME_CHROME_RUNTIME_API_DELEGATE_H_ | 86 #endif // CHROME_BROWSER_EXTENSIONS_API_RUNTIME_CHROME_RUNTIME_API_DELEGATE_H_ |
OLD | NEW |