| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "chrome/browser/extensions/extension_prefs.h" | 9 #include "chrome/browser/extensions/extension_prefs.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/extensions/platform_app_launcher.h" | 11 #include "chrome/browser/extensions/platform_app_launcher.h" |
| 12 #include "chrome/browser/extensions/tab_helper.h" | 12 #include "chrome/browser/extensions/tab_helper.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/browser_commands.h" | 15 #include "chrome/browser/ui/browser_commands.h" |
| 16 #include "chrome/browser/ui/browser_finder.h" | 16 #include "chrome/browser/ui/browser_finder.h" |
| 17 #include "chrome/browser/ui/browser_tabstrip.h" | 17 #include "chrome/browser/ui/browser_tabstrip.h" |
| 18 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
| 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 20 #include "chrome/browser/web_applications/web_app.h" | 20 #include "chrome/browser/web_applications/web_app.h" |
| 21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 22 #include "chrome/common/extensions/extension.h" | 22 #include "chrome/common/extensions/extension.h" |
| 23 #include "chrome/common/extensions/extension_constants.h" | 23 #include "chrome/common/extensions/extension_constants.h" |
| 24 #include "chrome/common/extensions/manifest_url_handler.h" |
| 24 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
| 25 #include "content/public/browser/render_view_host.h" | 26 #include "content/public/browser/render_view_host.h" |
| 26 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 27 #include "content/public/browser/web_contents_view.h" | 28 #include "content/public/browser/web_contents_view.h" |
| 28 #include "content/public/common/renderer_preferences.h" | 29 #include "content/public/common/renderer_preferences.h" |
| 29 #include "ui/gfx/rect.h" | 30 #include "ui/gfx/rect.h" |
| 30 | 31 |
| 31 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
| 32 #include "win8/util/win8_util.h" | 33 #include "win8/util/win8_util.h" |
| 33 #endif | 34 #endif |
| (...skipping 16 matching lines...) Expand all Loading... |
| 50 if (!override_url.is_empty()) { | 51 if (!override_url.is_empty()) { |
| 51 DCHECK(extension->web_extent().MatchesURL(override_url) || | 52 DCHECK(extension->web_extent().MatchesURL(override_url) || |
| 52 override_url.GetOrigin() == extension->url()); | 53 override_url.GetOrigin() == extension->url()); |
| 53 url = override_url; | 54 url = override_url; |
| 54 } else { | 55 } else { |
| 55 url = extension->GetFullLaunchURL(); | 56 url = extension->GetFullLaunchURL(); |
| 56 } | 57 } |
| 57 | 58 |
| 58 // For extensions lacking launch urls, determine a reasonable fallback. | 59 // For extensions lacking launch urls, determine a reasonable fallback. |
| 59 if (!url.is_valid()) { | 60 if (!url.is_valid()) { |
| 60 url = extension->options_url(); | 61 url = extensions::ManifestURL::GetOptionsPage(extension); |
| 61 if (!url.is_valid()) | 62 if (!url.is_valid()) |
| 62 url = GURL(chrome::kChromeUIExtensionsURL); | 63 url = GURL(chrome::kChromeUIExtensionsURL); |
| 63 } | 64 } |
| 64 | 65 |
| 65 return url; | 66 return url; |
| 66 } | 67 } |
| 67 | 68 |
| 68 WebContents* OpenApplicationWindow( | 69 WebContents* OpenApplicationWindow( |
| 69 Profile* profile, | 70 Profile* profile, |
| 70 const Extension* extension, | 71 const Extension* extension, |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 // OnDidGetApplicationInfo, which calls | 319 // OnDidGetApplicationInfo, which calls |
| 319 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as | 320 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as |
| 320 // pending web app action. | 321 // pending web app action. |
| 321 extensions::TabHelper::FromWebContents(tab)->set_pending_web_app_action( | 322 extensions::TabHelper::FromWebContents(tab)->set_pending_web_app_action( |
| 322 extensions::TabHelper::UPDATE_SHORTCUT); | 323 extensions::TabHelper::UPDATE_SHORTCUT); |
| 323 | 324 |
| 324 return tab; | 325 return tab; |
| 325 } | 326 } |
| 326 | 327 |
| 327 } // namespace application_launch | 328 } // namespace application_launch |
| OLD | NEW |