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

Side by Side Diff: chrome/browser/ui/ash/launcher/launcher_app_tab_helper.cc

Issue 489313002: Centralize command line checks for kEnableStreamlinedHostedApps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 3 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 | Annotate | Revision Log
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/ash/launcher/launcher_app_tab_helper.h" 5 #include "chrome/browser/ui/ash/launcher/launcher_app_tab_helper.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h"
10 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/extensions/extension_util.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/ui/browser_finder.h" 14 #include "chrome/browser/ui/browser_finder.h"
15 #include "chrome/browser/web_applications/web_app.h" 15 #include "chrome/browser/web_applications/web_app.h"
16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 16 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
18 #include "content/public/browser/navigation_entry.h" 17 #include "content/public/browser/navigation_entry.h"
19 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
20 #include "extensions/browser/extension_registry.h" 19 #include "extensions/browser/extension_registry.h"
21 #include "extensions/browser/extension_system.h" 20 #include "extensions/browser/extension_system.h"
22 #include "extensions/common/extension.h" 21 #include "extensions/common/extension.h"
23 #include "extensions/common/extension_set.h" 22 #include "extensions/common/extension_set.h"
24 23
25 namespace { 24 namespace {
26 25
(...skipping 20 matching lines...) Expand all
47 } 46 }
48 47
49 const GURL url = tab->GetURL(); 48 const GURL url = tab->GetURL();
50 const extensions::ExtensionSet& extensions = registry->enabled_extensions(); 49 const extensions::ExtensionSet& extensions = registry->enabled_extensions();
51 const extensions::Extension* extension = extensions.GetAppByURL(url); 50 const extensions::Extension* extension = extensions.GetAppByURL(url);
52 if (extension) 51 if (extension)
53 return extension; 52 return extension;
54 53
55 // Bookmark app windows should match their launch url extension despite 54 // Bookmark app windows should match their launch url extension despite
56 // their web extents. 55 // their web extents.
57 if (CommandLine::ForCurrentProcess()->HasSwitch( 56 if (extensions::util::IsStreamlinedHostedAppsEnabled()) {
58 switches::kEnableStreamlinedHostedApps)) {
59 for (extensions::ExtensionSet::const_iterator it = extensions.begin(); 57 for (extensions::ExtensionSet::const_iterator it = extensions.begin();
60 it != extensions.end(); ++it) { 58 it != extensions.end(); ++it) {
61 if (it->get()->from_bookmark() && 59 if (it->get()->from_bookmark() &&
62 extensions::AppLaunchInfo::GetLaunchWebURL(it->get()) == url) { 60 extensions::AppLaunchInfo::GetLaunchWebURL(it->get()) == url) {
63 return it->get(); 61 return it->get();
64 } 62 }
65 } 63 }
66 } 64 }
67 return NULL; 65 return NULL;
68 } 66 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return extension ? extension->id() : std::string(); 101 return extension ? extension->id() : std::string();
104 } 102 }
105 103
106 bool LauncherAppTabHelper::IsValidIDForCurrentUser(const std::string& id) { 104 bool LauncherAppTabHelper::IsValidIDForCurrentUser(const std::string& id) {
107 return GetExtensionByID(profile_, id) != NULL; 105 return GetExtensionByID(profile_, id) != NULL;
108 } 106 }
109 107
110 void LauncherAppTabHelper::SetCurrentUser(Profile* profile) { 108 void LauncherAppTabHelper::SetCurrentUser(Profile* profile) {
111 profile_ = profile; 109 profile_ = profile;
112 } 110 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/extension_app_model_builder.cc ('k') | chrome/browser/ui/ash/launcher/launcher_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698