| 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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 using content::WebContents; | 49 using content::WebContents; |
| 50 using extensions::Extension; | 50 using extensions::Extension; |
| 51 using extensions::ExtensionPrefs; | 51 using extensions::ExtensionPrefs; |
| 52 using extensions::ExtensionRegistry; | 52 using extensions::ExtensionRegistry; |
| 53 | 53 |
| 54 namespace { | 54 namespace { |
| 55 | 55 |
| 56 // Shows the app list for |desktop_type| and returns the app list's window. | 56 // Shows the app list for |desktop_type| and returns the app list's window. |
| 57 gfx::NativeWindow ShowAppListAndGetNativeWindow( | 57 gfx::NativeWindow ShowAppListAndGetNativeWindow( |
| 58 chrome::HostDesktopType desktop_type) { | 58 ui::HostDesktopType desktop_type) { |
| 59 AppListService* app_list_service = AppListService::Get(desktop_type); | 59 AppListService* app_list_service = AppListService::Get(desktop_type); |
| 60 app_list_service->Show(); | 60 app_list_service->Show(); |
| 61 return app_list_service->GetAppListWindow(); | 61 return app_list_service->GetAppListWindow(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Attempts to launch an app, prompting the user to enable it if necessary. If | 64 // Attempts to launch an app, prompting the user to enable it if necessary. If |
| 65 // a prompt is required it will be shown inside the window returned by | 65 // a prompt is required it will be shown inside the window returned by |
| 66 // |parent_window_getter|. | 66 // |parent_window_getter|. |
| 67 // This class manages its own lifetime. | 67 // This class manages its own lifetime. |
| 68 class EnableViaDialogFlow : public ExtensionEnableFlowDelegate { | 68 class EnableViaDialogFlow : public ExtensionEnableFlowDelegate { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 if (params.tabstrip_add_types & TabStripModel::ADD_ACTIVE) | 276 if (params.tabstrip_add_types & TabStripModel::ADD_ACTIVE) |
| 277 model->ActivateTabAt(tab_index, true); | 277 model->ActivateTabAt(tab_index, true); |
| 278 | 278 |
| 279 contents = existing_tab; | 279 contents = existing_tab; |
| 280 } else { | 280 } else { |
| 281 chrome::Navigate(¶ms); | 281 chrome::Navigate(¶ms); |
| 282 contents = params.target_contents; | 282 contents = params.target_contents; |
| 283 } | 283 } |
| 284 | 284 |
| 285 // On Chrome OS the host desktop type for a browser window is always set to | 285 // On Chrome OS the host desktop type for a browser window is always set to |
| 286 // HOST_DESKTOP_TYPE_ASH. On Windows 8 it is only the case for Chrome ASH | 286 // ui::HOST_DESKTOP_TYPE_ASH. On Windows 8 it is only the case for Chrome ASH |
| 287 // in metro mode. | 287 // in metro mode. |
| 288 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) { | 288 if (browser->host_desktop_type() == ui::HOST_DESKTOP_TYPE_ASH) { |
| 289 // In ash, LAUNCH_FULLSCREEN launches in the OpenApplicationWindow function | 289 // In ash, LAUNCH_FULLSCREEN launches in the OpenApplicationWindow function |
| 290 // i.e. it should not reach here. | 290 // i.e. it should not reach here. |
| 291 DCHECK(launch_type != extensions::LAUNCH_TYPE_FULLSCREEN); | 291 DCHECK(launch_type != extensions::LAUNCH_TYPE_FULLSCREEN); |
| 292 } else { | 292 } else { |
| 293 // TODO(skerner): If we are already in full screen mode, and the user | 293 // TODO(skerner): If we are already in full screen mode, and the user |
| 294 // set the app to open as a regular or pinned tab, what should happen? | 294 // set the app to open as a regular or pinned tab, what should happen? |
| 295 // Today we open the tab, but stay in full screen mode. Should we leave | 295 // Today we open the tab, but stay in full screen mode. Should we leave |
| 296 // full screen mode in this case? | 296 // full screen mode in this case? |
| 297 if (launch_type == extensions::LAUNCH_TYPE_FULLSCREEN && | 297 if (launch_type == extensions::LAUNCH_TYPE_FULLSCREEN && |
| 298 !browser->window()->IsFullscreen()) { | 298 !browser->window()->IsFullscreen()) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 extensions::TabHelper::FromWebContents(tab)->UpdateShortcutOnLoadComplete(); | 412 extensions::TabHelper::FromWebContents(tab)->UpdateShortcutOnLoadComplete(); |
| 413 | 413 |
| 414 return tab; | 414 return tab; |
| 415 } | 415 } |
| 416 | 416 |
| 417 bool CanLaunchViaEvent(const extensions::Extension* extension) { | 417 bool CanLaunchViaEvent(const extensions::Extension* extension) { |
| 418 const extensions::Feature* feature = | 418 const extensions::Feature* feature = |
| 419 extensions::FeatureProvider::GetAPIFeature("app.runtime"); | 419 extensions::FeatureProvider::GetAPIFeature("app.runtime"); |
| 420 return feature->IsAvailableToExtension(extension).is_available(); | 420 return feature->IsAvailableToExtension(extension).is_available(); |
| 421 } | 421 } |
| OLD | NEW |