| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef EXTENSIONS_BROWSER_API_RUNTIME_RUNTIME_EVENT_ROUTER_H_ | |
| 6 #define EXTENSIONS_BROWSER_API_RUNTIME_RUNTIME_EVENT_ROUTER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "chrome/common/extensions/api/runtime.h" | |
| 12 | |
| 13 namespace base { | |
| 14 class DictionaryValue; | |
| 15 class Version; | |
| 16 } | |
| 17 | |
| 18 namespace content { | |
| 19 class BrowserContext; | |
| 20 }; | |
| 21 | |
| 22 namespace extensions { | |
| 23 | |
| 24 // Dispatches events to extensions such as onStartup, onInstalled, etc. | |
| 25 class RuntimeEventRouter { | |
| 26 public: | |
| 27 // Dispatches the onStartup event to all currently-loaded extensions. | |
| 28 static void DispatchOnStartupEvent(content::BrowserContext* context, | |
| 29 const std::string& extension_id); | |
| 30 | |
| 31 // Dispatches the onInstalled event to the given extension. | |
| 32 static void DispatchOnInstalledEvent(content::BrowserContext* context, | |
| 33 const std::string& extension_id, | |
| 34 const base::Version& old_version, | |
| 35 bool chrome_updated); | |
| 36 | |
| 37 // Dispatches the onUpdateAvailable event to the given extension. | |
| 38 static void DispatchOnUpdateAvailableEvent( | |
| 39 content::BrowserContext* context, | |
| 40 const std::string& extension_id, | |
| 41 const base::DictionaryValue* manifest); | |
| 42 | |
| 43 // Dispatches the onBrowserUpdateAvailable event to all extensions. | |
| 44 static void DispatchOnBrowserUpdateAvailableEvent( | |
| 45 content::BrowserContext* context); | |
| 46 | |
| 47 // Dispatches the onRestartRequired event to the given app. | |
| 48 static void DispatchOnRestartRequiredEvent( | |
| 49 content::BrowserContext* context, | |
| 50 const std::string& app_id, | |
| 51 api::runtime::OnRestartRequired::Reason reason); | |
| 52 | |
| 53 private: | |
| 54 DISALLOW_IMPLICIT_CONSTRUCTORS(RuntimeEventRouter); | |
| 55 }; | |
| 56 | |
| 57 } // namespace extensions | |
| 58 | |
| 59 #endif // EXTENSIONS_BROWSER_API_RUNTIME_RUNTIME_EVENT_ROUTER_H_ | |
| OLD | NEW |