| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/common/extensions/extension.h" | 23 #include "chrome/common/extensions/extension.h" |
| 24 #include "chrome/common/extensions/extension_constants.h" | 24 #include "chrome/common/extensions/extension_constants.h" |
| 25 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
| 26 #include "content/public/browser/render_view_host.h" | 26 #include "content/public/browser/render_view_host.h" |
| 27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 28 #include "content/public/browser/web_contents_view.h" | 28 #include "content/public/browser/web_contents_view.h" |
| 29 #include "content/public/common/renderer_preferences.h" | 29 #include "content/public/common/renderer_preferences.h" |
| 30 #include "ui/gfx/rect.h" | 30 #include "ui/gfx/rect.h" |
| 31 | 31 |
| 32 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
| 33 #include "base/win/metro.h" | 33 #include "win8/util/win8_util.h" |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 using content::WebContents; | 36 using content::WebContents; |
| 37 using extensions::Extension; | 37 using extensions::Extension; |
| 38 using extensions::ExtensionPrefs; | 38 using extensions::ExtensionPrefs; |
| 39 | 39 |
| 40 namespace { | 40 namespace { |
| 41 | 41 |
| 42 // Get the launch URL for a given extension, with optional override/fallback. | 42 // Get the launch URL for a given extension, with optional override/fallback. |
| 43 // |override_url|, if non-empty, will be preferred over the extension's | 43 // |override_url|, if non-empty, will be preferred over the extension's |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 extension, ExtensionPrefs::LAUNCH_DEFAULT); | 105 extension, ExtensionPrefs::LAUNCH_DEFAULT); |
| 106 if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN) | 106 if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN) |
| 107 params.initial_show_state = ui::SHOW_STATE_MAXIMIZED; | 107 params.initial_show_state = ui::SHOW_STATE_MAXIMIZED; |
| 108 else if (launch_type == ExtensionPrefs::LAUNCH_WINDOW) | 108 else if (launch_type == ExtensionPrefs::LAUNCH_WINDOW) |
| 109 params.initial_show_state = ui::SHOW_STATE_NORMAL; | 109 params.initial_show_state = ui::SHOW_STATE_NORMAL; |
| 110 } | 110 } |
| 111 #endif | 111 #endif |
| 112 | 112 |
| 113 Browser* browser = NULL; | 113 Browser* browser = NULL; |
| 114 #if defined(OS_WIN) | 114 #if defined(OS_WIN) |
| 115 // In Chrome on Windows 8 in metro mode we don't allow multiple chrome | 115 // On Windows 8's single window Metro mode we don't allow multiple Chrome |
| 116 // windows to be created, as we don't have a good way to switch between | 116 // windows to be created. We instead attempt to reuse an existing Browser |
| 117 // them. We attempt to reuse an existing Browser window. | 117 // window. |
| 118 if (base::win::IsMetroProcess()) { | 118 if (win8::IsSingleWindowMetroMode()) { |
| 119 browser = browser::FindBrowserWithProfile( | 119 browser = browser::FindBrowserWithProfile( |
| 120 profile, chrome::HOST_DESKTOP_TYPE_NATIVE); | 120 profile, chrome::HOST_DESKTOP_TYPE_NATIVE); |
| 121 } | 121 } |
| 122 #endif | 122 #endif |
| 123 if (!browser) | 123 if (!browser) |
| 124 browser = new Browser(params); | 124 browser = new Browser(params); |
| 125 | 125 |
| 126 if (app_browser) | 126 if (app_browser) |
| 127 *app_browser = browser; | 127 *app_browser = browser; |
| 128 | 128 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 // OnDidGetApplicationInfo, which calls | 297 // OnDidGetApplicationInfo, which calls |
| 298 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as | 298 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as |
| 299 // pending web app action. | 299 // pending web app action. |
| 300 extensions::TabHelper::FromWebContents(tab)->set_pending_web_app_action( | 300 extensions::TabHelper::FromWebContents(tab)->set_pending_web_app_action( |
| 301 extensions::TabHelper::UPDATE_SHORTCUT); | 301 extensions::TabHelper::UPDATE_SHORTCUT); |
| 302 | 302 |
| 303 return tab; | 303 return tab; |
| 304 } | 304 } |
| 305 | 305 |
| 306 } // namespace application_launch | 306 } // namespace application_launch |
| OLD | NEW |