Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(676)

Side by Side Diff: chrome/browser/ui/extensions/application_launch.cc

Issue 265503003: Enable file_handlers and chrome.app.runtime for QuickOffice. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback, less hacky Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 21 matching lines...) Expand all
32 #include "chrome/common/extensions/manifest_url_handler.h" 32 #include "chrome/common/extensions/manifest_url_handler.h"
33 #include "chrome/common/url_constants.h" 33 #include "chrome/common/url_constants.h"
34 #include "content/public/browser/render_view_host.h" 34 #include "content/public/browser/render_view_host.h"
35 #include "content/public/browser/web_contents.h" 35 #include "content/public/browser/web_contents.h"
36 #include "content/public/common/renderer_preferences.h" 36 #include "content/public/common/renderer_preferences.h"
37 #include "extensions/browser/extension_prefs.h" 37 #include "extensions/browser/extension_prefs.h"
38 #include "extensions/browser/extension_registry.h" 38 #include "extensions/browser/extension_registry.h"
39 #include "extensions/browser/extension_system.h" 39 #include "extensions/browser/extension_system.h"
40 #include "extensions/common/constants.h" 40 #include "extensions/common/constants.h"
41 #include "extensions/common/extension.h" 41 #include "extensions/common/extension.h"
42 #include "extensions/common/features/feature.h"
43 #include "extensions/common/features/feature_provider.h"
42 #include "grit/generated_resources.h" 44 #include "grit/generated_resources.h"
43 #include "ui/base/window_open_disposition.h" 45 #include "ui/base/window_open_disposition.h"
44 #include "ui/gfx/rect.h" 46 #include "ui/gfx/rect.h"
45 47
46 #if defined(OS_MACOSX) 48 #if defined(OS_MACOSX)
47 #include "chrome/browser/ui/browser_commands_mac.h" 49 #include "chrome/browser/ui/browser_commands_mac.h"
48 #endif 50 #endif
49 51
50 using content::WebContents; 52 using content::WebContents;
51 using extensions::Extension; 53 using extensions::Extension;
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 return NULL; 317 return NULL;
316 Profile* profile = params.profile; 318 Profile* profile = params.profile;
317 319
318 WebContents* tab = NULL; 320 WebContents* tab = NULL;
319 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile); 321 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile);
320 prefs->SetActiveBit(extension->id(), true); 322 prefs->SetActiveBit(extension->id(), true);
321 323
322 UMA_HISTOGRAM_ENUMERATION( 324 UMA_HISTOGRAM_ENUMERATION(
323 "Extensions.AppLaunchContainer", params.container, 100); 325 "Extensions.AppLaunchContainer", params.container, 100);
324 326
325 if (extension->is_platform_app()) { 327 if (CanLaunchViaEvent(extension)) {
326 // Remember what desktop the launch happened on so that when the app opens a 328 // Remember what desktop the launch happened on so that when the app opens a
327 // window we can open them on the right desktop. 329 // window we can open them on the right desktop.
328 PerAppSettingsServiceFactory::GetForBrowserContext(profile)-> 330 PerAppSettingsServiceFactory::GetForBrowserContext(profile)->
329 SetDesktopLastLaunchedFrom(extension->id(), params.desktop_type); 331 SetDesktopLastLaunchedFrom(extension->id(), params.desktop_type);
330 332
331 apps::LaunchPlatformAppWithCommandLine( 333 apps::LaunchPlatformAppWithCommandLine(
332 profile, extension, params.command_line, params.current_directory); 334 profile, extension, params.command_line, params.current_directory);
333 return NULL; 335 return NULL;
334 } 336 }
335 337
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 // up in LoadingStateChanged to schedule a GetApplicationInfo. And when 461 // up in LoadingStateChanged to schedule a GetApplicationInfo. And when
460 // the web app info is available, extensions::TabHelper notifies Browser via 462 // the web app info is available, extensions::TabHelper notifies Browser via
461 // OnDidGetApplicationInfo, which calls 463 // OnDidGetApplicationInfo, which calls
462 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as 464 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as
463 // pending web app action. 465 // pending web app action.
464 extensions::TabHelper::FromWebContents(tab)->set_pending_web_app_action( 466 extensions::TabHelper::FromWebContents(tab)->set_pending_web_app_action(
465 extensions::TabHelper::UPDATE_SHORTCUT); 467 extensions::TabHelper::UPDATE_SHORTCUT);
466 468
467 return tab; 469 return tab;
468 } 470 }
471
472 bool CanLaunchViaEvent(const extensions::Extension* extension) {
473 extensions::FeatureProvider* feature_provider =
474 extensions::FeatureProvider::GetAPIFeatures();
475 extensions::Feature* feature = feature_provider->GetFeature("app.runtime");
476 return feature->IsAvailableToExtension(extension).is_available();
477 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/extensions/application_launch.h ('k') | chrome/browser/ui/startup/startup_browser_creator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698