| 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 #include "athena/extensions/public/extensions_delegate.h" | 5 #include "athena/extensions/public/extensions_delegate.h" |
| 6 | 6 |
| 7 #include "athena/activity/public/activity_factory.h" | 7 #include "athena/activity/public/activity_factory.h" |
| 8 #include "athena/extensions/chrome/athena_chrome_app_window_client.h" | 8 #include "athena/extensions/chrome/athena_chrome_app_window_client.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 extensions::ExtensionSystem::Get(context)->extension_service()) { | 30 extensions::ExtensionSystem::Get(context)->extension_service()) { |
| 31 extensions::AppWindowClient::Set(&app_window_client_); | 31 extensions::AppWindowClient::Set(&app_window_client_); |
| 32 } | 32 } |
| 33 | 33 |
| 34 virtual ~ChromeExtensionsDelegate() { | 34 virtual ~ChromeExtensionsDelegate() { |
| 35 extensions::AppWindowClient::Set(NULL); | 35 extensions::AppWindowClient::Set(NULL); |
| 36 } | 36 } |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 // ExtensionsDelegate: | 39 // ExtensionsDelegate: |
| 40 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE { | 40 virtual content::BrowserContext* GetBrowserContext() const override { |
| 41 return extension_service_->GetBrowserContext(); | 41 return extension_service_->GetBrowserContext(); |
| 42 } | 42 } |
| 43 virtual const extensions::ExtensionSet& GetInstalledExtensions() OVERRIDE { | 43 virtual const extensions::ExtensionSet& GetInstalledExtensions() override { |
| 44 return *extension_service_->extensions(); | 44 return *extension_service_->extensions(); |
| 45 } | 45 } |
| 46 virtual bool LaunchApp(const std::string& app_id) OVERRIDE { | 46 virtual bool LaunchApp(const std::string& app_id) override { |
| 47 // Check Running apps | 47 // Check Running apps |
| 48 content::BrowserContext* context = GetBrowserContext(); | 48 content::BrowserContext* context = GetBrowserContext(); |
| 49 const extensions::Extension* extension = | 49 const extensions::Extension* extension = |
| 50 extensions::ExtensionRegistry::Get(context)->GetExtensionById( | 50 extensions::ExtensionRegistry::Get(context)->GetExtensionById( |
| 51 app_id, extensions::ExtensionRegistry::EVERYTHING); | 51 app_id, extensions::ExtensionRegistry::EVERYTHING); |
| 52 DCHECK(extension); | 52 DCHECK(extension); |
| 53 if (!extension) | 53 if (!extension) |
| 54 return false; | 54 return false; |
| 55 | 55 |
| 56 // TODO(oshima): Support installation/enabling process. | 56 // TODO(oshima): Support installation/enabling process. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 77 | 77 |
| 78 // V2 apps | 78 // V2 apps |
| 79 if (CanLaunchViaEvent(extension)) { | 79 if (CanLaunchViaEvent(extension)) { |
| 80 OpenApplication(params); | 80 OpenApplication(params); |
| 81 return true; | 81 return true; |
| 82 } | 82 } |
| 83 LaunchV1App(params, extension); | 83 LaunchV1App(params, extension); |
| 84 return true; | 84 return true; |
| 85 } | 85 } |
| 86 | 86 |
| 87 virtual bool UnloadApp(const std::string& app_id) OVERRIDE { | 87 virtual bool UnloadApp(const std::string& app_id) override { |
| 88 // TODO(skuhne): Implement using extension service. | 88 // TODO(skuhne): Implement using extension service. |
| 89 return false; | 89 return false; |
| 90 } | 90 } |
| 91 | 91 |
| 92 void LaunchV1App(const AppLaunchParams& params, | 92 void LaunchV1App(const AppLaunchParams& params, |
| 93 const extensions::Extension* extension) { | 93 const extensions::Extension* extension) { |
| 94 // TODO(oshima): Just activate if the app is already running. | 94 // TODO(oshima): Just activate if the app is already running. |
| 95 const GURL url_input = params.override_url; | 95 const GURL url_input = params.override_url; |
| 96 | 96 |
| 97 DCHECK(!url_input.is_empty() || extension); | 97 DCHECK(!url_input.is_empty() || extension); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 113 | 113 |
| 114 } // namespace | 114 } // namespace |
| 115 | 115 |
| 116 // static | 116 // static |
| 117 void ExtensionsDelegate::CreateExtensionsDelegate( | 117 void ExtensionsDelegate::CreateExtensionsDelegate( |
| 118 content::BrowserContext* context) { | 118 content::BrowserContext* context) { |
| 119 new ChromeExtensionsDelegate(context); | 119 new ChromeExtensionsDelegate(context); |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace athena | 122 } // namespace athena |
| OLD | NEW |