| 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 #include "chrome/browser/ui/extensions/application_launch.h" | 5 #include "chrome/browser/ui/extensions/application_launch.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "apps/launcher.h" | 9 #include "apps/launcher.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/ui/browser_commands.h" | 22 #include "chrome/browser/ui/browser_commands.h" |
| 23 #include "chrome/browser/ui/browser_finder.h" | 23 #include "chrome/browser/ui/browser_finder.h" |
| 24 #include "chrome/browser/ui/browser_tabstrip.h" | 24 #include "chrome/browser/ui/browser_tabstrip.h" |
| 25 #include "chrome/browser/ui/browser_window.h" | 25 #include "chrome/browser/ui/browser_window.h" |
| 26 #include "chrome/browser/ui/extensions/extension_enable_flow.h" | 26 #include "chrome/browser/ui/extensions/extension_enable_flow.h" |
| 27 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" | 27 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" |
| 28 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 28 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 29 #include "chrome/browser/web_applications/web_app.h" | 29 #include "chrome/browser/web_applications/web_app.h" |
| 30 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
| 31 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 31 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
| 32 #include "chrome/common/extensions/manifest_url_handler.h" | |
| 33 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 34 #include "content/public/browser/render_view_host.h" | 33 #include "content/public/browser/render_view_host.h" |
| 35 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
| 36 #include "content/public/common/renderer_preferences.h" | 35 #include "content/public/common/renderer_preferences.h" |
| 37 #include "extensions/browser/extension_prefs.h" | 36 #include "extensions/browser/extension_prefs.h" |
| 38 #include "extensions/browser/extension_registry.h" | 37 #include "extensions/browser/extension_registry.h" |
| 39 #include "extensions/browser/extension_system.h" | 38 #include "extensions/browser/extension_system.h" |
| 40 #include "extensions/common/constants.h" | 39 #include "extensions/common/constants.h" |
| 41 #include "extensions/common/extension.h" | 40 #include "extensions/common/extension.h" |
| 42 #include "extensions/common/features/feature.h" | 41 #include "extensions/common/features/feature.h" |
| 43 #include "extensions/common/features/feature_provider.h" | 42 #include "extensions/common/features/feature_provider.h" |
| 43 #include "extensions/common/manifest_handlers/options_page_info.h" |
| 44 #include "ui/base/window_open_disposition.h" | 44 #include "ui/base/window_open_disposition.h" |
| 45 #include "ui/gfx/rect.h" | 45 #include "ui/gfx/rect.h" |
| 46 | 46 |
| 47 #if defined(OS_MACOSX) | 47 #if defined(OS_MACOSX) |
| 48 #include "chrome/browser/ui/browser_commands_mac.h" | 48 #include "chrome/browser/ui/browser_commands_mac.h" |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 using content::WebContents; | 51 using content::WebContents; |
| 52 using extensions::Extension; | 52 using extensions::Extension; |
| 53 using extensions::ExtensionPrefs; | 53 using extensions::ExtensionPrefs; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 if (!override_url.is_empty()) { | 135 if (!override_url.is_empty()) { |
| 136 DCHECK(extension->web_extent().MatchesURL(override_url) || | 136 DCHECK(extension->web_extent().MatchesURL(override_url) || |
| 137 override_url.GetOrigin() == extension->url()); | 137 override_url.GetOrigin() == extension->url()); |
| 138 url = override_url; | 138 url = override_url; |
| 139 } else { | 139 } else { |
| 140 url = extensions::AppLaunchInfo::GetFullLaunchURL(extension); | 140 url = extensions::AppLaunchInfo::GetFullLaunchURL(extension); |
| 141 } | 141 } |
| 142 | 142 |
| 143 // For extensions lacking launch urls, determine a reasonable fallback. | 143 // For extensions lacking launch urls, determine a reasonable fallback. |
| 144 if (!url.is_valid()) { | 144 if (!url.is_valid()) { |
| 145 url = extensions::ManifestURL::GetOptionsPage(extension); | 145 url = extensions::OptionsPageInfo::GetOptionsPage(extension); |
| 146 if (!url.is_valid()) | 146 if (!url.is_valid()) |
| 147 url = GURL(chrome::kChromeUIExtensionsURL); | 147 url = GURL(chrome::kChromeUIExtensionsURL); |
| 148 } | 148 } |
| 149 | 149 |
| 150 return url; | 150 return url; |
| 151 } | 151 } |
| 152 | 152 |
| 153 ui::WindowShowState DetermineWindowShowState( | 153 ui::WindowShowState DetermineWindowShowState( |
| 154 Profile* profile, | 154 Profile* profile, |
| 155 extensions::LaunchContainer container, | 155 extensions::LaunchContainer container, |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 460 |
| 461 return tab; | 461 return tab; |
| 462 } | 462 } |
| 463 | 463 |
| 464 bool CanLaunchViaEvent(const extensions::Extension* extension) { | 464 bool CanLaunchViaEvent(const extensions::Extension* extension) { |
| 465 const extensions::FeatureProvider* feature_provider = | 465 const extensions::FeatureProvider* feature_provider = |
| 466 extensions::FeatureProvider::GetAPIFeatures(); | 466 extensions::FeatureProvider::GetAPIFeatures(); |
| 467 extensions::Feature* feature = feature_provider->GetFeature("app.runtime"); | 467 extensions::Feature* feature = feature_provider->GetFeature("app.runtime"); |
| 468 return feature->IsAvailableToExtension(extension).is_available(); | 468 return feature->IsAvailableToExtension(extension).is_available(); |
| 469 } | 469 } |
| OLD | NEW |