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

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: 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 22 matching lines...) Expand all
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/browser/web_contents_view.h" 36 #include "content/public/browser/web_contents_view.h"
37 #include "content/public/common/renderer_preferences.h" 37 #include "content/public/common/renderer_preferences.h"
38 #include "extensions/browser/extension_prefs.h" 38 #include "extensions/browser/extension_prefs.h"
39 #include "extensions/browser/extension_registry.h" 39 #include "extensions/browser/extension_registry.h"
40 #include "extensions/browser/extension_system.h" 40 #include "extensions/browser/extension_system.h"
41 #include "extensions/common/constants.h" 41 #include "extensions/common/constants.h"
42 #include "extensions/common/extension.h" 42 #include "extensions/common/extension.h"
43 #include "extensions/common/features/feature.h"
44 #include "extensions/common/features/feature_provider.h"
43 #include "grit/generated_resources.h" 45 #include "grit/generated_resources.h"
44 #include "ui/base/window_open_disposition.h" 46 #include "ui/base/window_open_disposition.h"
45 #include "ui/gfx/rect.h" 47 #include "ui/gfx/rect.h"
46 48
47 #if defined(OS_MACOSX) 49 #if defined(OS_MACOSX)
48 #include "chrome/browser/ui/browser_commands_mac.h" 50 #include "chrome/browser/ui/browser_commands_mac.h"
49 #endif 51 #endif
50 52
51 using content::WebContents; 53 using content::WebContents;
52 using extensions::Extension; 54 using extensions::Extension;
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 return NULL; 318 return NULL;
317 Profile* profile = params.profile; 319 Profile* profile = params.profile;
318 320
319 WebContents* tab = NULL; 321 WebContents* tab = NULL;
320 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile); 322 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile);
321 prefs->SetActiveBit(extension->id(), true); 323 prefs->SetActiveBit(extension->id(), true);
322 324
323 UMA_HISTOGRAM_ENUMERATION( 325 UMA_HISTOGRAM_ENUMERATION(
324 "Extensions.AppLaunchContainer", params.container, 100); 326 "Extensions.AppLaunchContainer", params.container, 100);
325 327
326 if (extension->is_platform_app()) { 328 if (LaunchesViaEvent(extension)) {
327 // Remember what desktop the launch happened on so that when the app opens a 329 // Remember what desktop the launch happened on so that when the app opens a
328 // window we can open them on the right desktop. 330 // window we can open them on the right desktop.
329 PerAppSettingsServiceFactory::GetForBrowserContext(profile)-> 331 PerAppSettingsServiceFactory::GetForBrowserContext(profile)->
330 SetDesktopLastLaunchedFrom(extension->id(), params.desktop_type); 332 SetDesktopLastLaunchedFrom(extension->id(), params.desktop_type);
331 333
332 apps::LaunchPlatformAppWithCommandLine( 334 apps::LaunchPlatformAppWithCommandLine(
333 profile, extension, params.command_line, params.current_directory); 335 profile, extension, params.command_line, params.current_directory);
334 return NULL; 336 return NULL;
335 } 337 }
336 338
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 // up in LoadingStateChanged to schedule a GetApplicationInfo. And when 462 // up in LoadingStateChanged to schedule a GetApplicationInfo. And when
461 // the web app info is available, extensions::TabHelper notifies Browser via 463 // the web app info is available, extensions::TabHelper notifies Browser via
462 // OnDidGetApplicationInfo, which calls 464 // OnDidGetApplicationInfo, which calls
463 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as 465 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as
464 // pending web app action. 466 // pending web app action.
465 extensions::TabHelper::FromWebContents(tab)->set_pending_web_app_action( 467 extensions::TabHelper::FromWebContents(tab)->set_pending_web_app_action(
466 extensions::TabHelper::UPDATE_SHORTCUT); 468 extensions::TabHelper::UPDATE_SHORTCUT);
467 469
468 return tab; 470 return tab;
469 } 471 }
472
473 bool LaunchesViaEvent(const extensions::Extension* extension) {
474 extensions::FeatureProvider* feature_provider =
475 extensions::FeatureProvider::GetAPIFeatures();
476 extensions::Feature* feature = feature_provider->GetFeature("app.runtime");
477 return feature->IsAvailableToExtension(extension).is_available();
478 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698