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

Side by Side Diff: chrome/browser/ui/app_list/extension_app_model_builder.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/app_list/extension_app_model_builder.h" 5 #include "chrome/browser/ui/app_list/extension_app_model_builder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/command_line.h"
13 #include "chrome/browser/extensions/extension_ui_util.h" 12 #include "chrome/browser/extensions/extension_ui_util.h"
13 #include "chrome/browser/extensions/extension_util.h"
14 #include "chrome/browser/extensions/install_tracker.h" 14 #include "chrome/browser/extensions/install_tracker.h"
15 #include "chrome/browser/extensions/install_tracker_factory.h" 15 #include "chrome/browser/extensions/install_tracker_factory.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" 17 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
18 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" 18 #include "chrome/browser/ui/app_list/app_list_syncable_service.h"
19 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" 19 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h"
20 #include "chrome/browser/ui/app_list/extension_app_item.h" 20 #include "chrome/browser/ui/app_list/extension_app_item.h"
21 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
23 #include "extensions/browser/extension_prefs.h" 22 #include "extensions/browser/extension_prefs.h"
24 #include "extensions/browser/extension_registry.h" 23 #include "extensions/browser/extension_registry.h"
25 #include "extensions/browser/extension_system.h" 24 #include "extensions/browser/extension_system.h"
26 #include "extensions/browser/extensions_browser_client.h" 25 #include "extensions/browser/extensions_browser_client.h"
27 #include "extensions/browser/pref_names.h" 26 #include "extensions/browser/pref_names.h"
28 #include "extensions/common/constants.h" 27 #include "extensions/common/constants.h"
29 #include "extensions/common/extension.h" 28 #include "extensions/common/extension.h"
30 #include "extensions/common/extension_set.h" 29 #include "extensions/common/extension_set.h"
31 #include "ui/gfx/image/image_skia.h" 30 #include "ui/gfx/image/image_skia.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 BuildModel(); 73 BuildModel();
75 } 74 }
76 75
77 void ExtensionAppModelBuilder::InitializePrefChangeRegistrars() { 76 void ExtensionAppModelBuilder::InitializePrefChangeRegistrars() {
78 profile_pref_change_registrar_.Init(profile_->GetPrefs()); 77 profile_pref_change_registrar_.Init(profile_->GetPrefs());
79 profile_pref_change_registrar_.Add( 78 profile_pref_change_registrar_.Add(
80 prefs::kHideWebStoreIcon, 79 prefs::kHideWebStoreIcon,
81 base::Bind(&ExtensionAppModelBuilder::OnProfilePreferenceChanged, 80 base::Bind(&ExtensionAppModelBuilder::OnProfilePreferenceChanged,
82 base::Unretained(this))); 81 base::Unretained(this)));
83 82
84 if (!CommandLine::ForCurrentProcess()->HasSwitch( 83 if (!extensions::util::IsStreamlinedHostedAppsEnabled())
85 switches::kEnableStreamlinedHostedApps))
86 return; 84 return;
87 85
88 // TODO(calamity): analyze the performance impact of doing this every 86 // TODO(calamity): analyze the performance impact of doing this every
89 // extension pref change. 87 // extension pref change.
90 extensions::ExtensionsBrowserClient* client = 88 extensions::ExtensionsBrowserClient* client =
91 extensions::ExtensionsBrowserClient::Get(); 89 extensions::ExtensionsBrowserClient::Get();
92 extension_pref_change_registrar_.Init( 90 extension_pref_change_registrar_.Init(
93 client->GetPrefServiceForContext(profile_)); 91 client->GetPrefServiceForContext(profile_));
94 extension_pref_change_registrar_.Add( 92 extension_pref_change_registrar_.Add(
95 extensions::pref_names::kExtensions, 93 extensions::pref_names::kExtensions,
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 app_list::AppListItem* item = item_list->item_at(idx + 1); 359 app_list::AppListItem* item = item_list->item_at(idx + 1);
362 if (item->GetItemType() == ExtensionAppItem::kItemType) { 360 if (item->GetItemType() == ExtensionAppItem::kItemType) {
363 next = static_cast<ExtensionAppItem*>(item); 361 next = static_cast<ExtensionAppItem*>(item);
364 break; 362 break;
365 } 363 }
366 } 364 }
367 // item->Move will call set_position, overriding the item's position. 365 // item->Move will call set_position, overriding the item's position.
368 if (prev || next) 366 if (prev || next)
369 static_cast<ExtensionAppItem*>(item)->Move(prev, next); 367 static_cast<ExtensionAppItem*>(item)->Move(prev, next);
370 } 368 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/extension_app_item.cc ('k') | chrome/browser/ui/ash/launcher/launcher_app_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698