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

Side by Side Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 14241002: Move the parsing of app.launch related keys out of Extension class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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/webui/ntp/app_launcher_handler.h" 5 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "apps/pref_names.h" 9 #include "apps/pref_names.h"
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 17 matching lines...) Expand all
28 #include "chrome/browser/profiles/profile.h" 28 #include "chrome/browser/profiles/profile.h"
29 #include "chrome/browser/ui/browser_finder.h" 29 #include "chrome/browser/ui/browser_finder.h"
30 #include "chrome/browser/ui/browser_tabstrip.h" 30 #include "chrome/browser/ui/browser_tabstrip.h"
31 #include "chrome/browser/ui/browser_window.h" 31 #include "chrome/browser/ui/browser_window.h"
32 #include "chrome/browser/ui/extensions/application_launch.h" 32 #include "chrome/browser/ui/extensions/application_launch.h"
33 #include "chrome/browser/ui/extensions/extension_enable_flow.h" 33 #include "chrome/browser/ui/extensions/extension_enable_flow.h"
34 #include "chrome/browser/ui/tabs/tab_strip_model.h" 34 #include "chrome/browser/ui/tabs/tab_strip_model.h"
35 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" 35 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
36 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 36 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
37 #include "chrome/common/chrome_notification_types.h" 37 #include "chrome/common/chrome_notification_types.h"
38 #include "chrome/common/extensions/app_launcher_info.h"
38 #include "chrome/common/extensions/extension.h" 39 #include "chrome/common/extensions/extension.h"
39 #include "chrome/common/extensions/extension_constants.h" 40 #include "chrome/common/extensions/extension_constants.h"
40 #include "chrome/common/extensions/extension_icon_set.h" 41 #include "chrome/common/extensions/extension_icon_set.h"
41 #include "chrome/common/pref_names.h" 42 #include "chrome/common/pref_names.h"
42 #include "chrome/common/url_constants.h" 43 #include "chrome/common/url_constants.h"
43 #include "chrome/common/web_apps.h" 44 #include "chrome/common/web_apps.h"
44 #include "components/user_prefs/pref_registry_syncable.h" 45 #include "components/user_prefs/pref_registry_syncable.h"
45 #include "content/public/browser/notification_service.h" 46 #include "content/public/browser/notification_service.h"
46 #include "content/public/browser/web_ui.h" 47 #include "content/public/browser/web_ui.h"
47 #include "content/public/common/favicon_url.h" 48 #include "content/public/common/favicon_url.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 void AppLauncherHandler::CreateAppInfo( 92 void AppLauncherHandler::CreateAppInfo(
92 const Extension* extension, 93 const Extension* extension,
93 ExtensionService* service, 94 ExtensionService* service,
94 DictionaryValue* value) { 95 DictionaryValue* value) {
95 value->Clear(); 96 value->Clear();
96 97
97 // The Extension class 'helpfully' wraps bidi control characters that 98 // The Extension class 'helpfully' wraps bidi control characters that
98 // impede our ability to determine directionality. 99 // impede our ability to determine directionality.
99 string16 name = UTF8ToUTF16(extension->name()); 100 string16 name = UTF8ToUTF16(extension->name());
100 base::i18n::UnadjustStringForLocaleDirection(&name); 101 base::i18n::UnadjustStringForLocaleDirection(&name);
101 NewTabUI::SetUrlTitleAndDirection(value, name, extension->GetFullLaunchURL()); 102 NewTabUI::SetUrlTitleAndDirection(
103 value, name, extensions::AppLauncherInfo::GetFullLaunchURL(extension));
102 104
103 bool enabled = service->IsExtensionEnabled(extension->id()) && 105 bool enabled = service->IsExtensionEnabled(extension->id()) &&
104 !service->GetTerminatedExtension(extension->id()); 106 !service->GetTerminatedExtension(extension->id());
105 extension->GetBasicInfo(enabled, value); 107 extension->GetBasicInfo(enabled, value);
106 108
107 value->SetBoolean("mayDisable", extensions::ExtensionSystem::Get( 109 value->SetBoolean("mayDisable", extensions::ExtensionSystem::Get(
108 service->profile())->management_policy()->UserMayModifySettings( 110 service->profile())->management_policy()->UserMayModifySettings(
109 extension, NULL)); 111 extension, NULL));
110 112
111 bool icon_big_exists = true; 113 bool icon_big_exists = true;
112 // Instead of setting grayscale here, we do it in apps_page.js. 114 // Instead of setting grayscale here, we do it in apps_page.js.
113 GURL icon_big = 115 GURL icon_big =
114 ExtensionIconSource::GetIconURL(extension, 116 ExtensionIconSource::GetIconURL(extension,
115 extension_misc::EXTENSION_ICON_LARGE, 117 extension_misc::EXTENSION_ICON_LARGE,
116 ExtensionIconSet::MATCH_BIGGER, 118 ExtensionIconSet::MATCH_BIGGER,
117 false, &icon_big_exists); 119 false, &icon_big_exists);
118 value->SetString("icon_big", icon_big.spec()); 120 value->SetString("icon_big", icon_big.spec());
119 value->SetBoolean("icon_big_exists", icon_big_exists); 121 value->SetBoolean("icon_big_exists", icon_big_exists);
120 bool icon_small_exists = true; 122 bool icon_small_exists = true;
121 GURL icon_small = 123 GURL icon_small =
122 ExtensionIconSource::GetIconURL(extension, 124 ExtensionIconSource::GetIconURL(extension,
123 extension_misc::EXTENSION_ICON_BITTY, 125 extension_misc::EXTENSION_ICON_BITTY,
124 ExtensionIconSet::MATCH_BIGGER, 126 ExtensionIconSet::MATCH_BIGGER,
125 false, &icon_small_exists); 127 false, &icon_small_exists);
126 value->SetString("icon_small", icon_small.spec()); 128 value->SetString("icon_small", icon_small.spec());
127 value->SetBoolean("icon_small_exists", icon_small_exists); 129 value->SetBoolean("icon_small_exists", icon_small_exists);
128 value->SetInteger("launch_container", extension->launch_container()); 130 value->SetInteger("launch_container",
131 extensions::AppLauncherInfo::GetLaunchContainer(extension));
129 ExtensionPrefs* prefs = service->extension_prefs(); 132 ExtensionPrefs* prefs = service->extension_prefs();
130 value->SetInteger("launch_type", 133 value->SetInteger("launch_type",
131 prefs->GetLaunchType(extension, 134 prefs->GetLaunchType(extension,
132 ExtensionPrefs::LAUNCH_DEFAULT)); 135 ExtensionPrefs::LAUNCH_DEFAULT));
133 value->SetBoolean("is_component", 136 value->SetBoolean("is_component",
134 extension->location() == extensions::Manifest::COMPONENT); 137 extension->location() == extensions::Manifest::COMPONENT);
135 value->SetBoolean("is_webstore", 138 value->SetBoolean("is_webstore",
136 extension->id() == extension_misc::kWebStoreAppId); 139 extension->id() == extension_misc::kWebStoreAppId);
137 140
138 ExtensionSorting* sorting = prefs->extension_sorting(); 141 ExtensionSorting* sorting = prefs->extension_sorting();
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { 840 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() {
838 if (!extension_uninstall_dialog_.get()) { 841 if (!extension_uninstall_dialog_.get()) {
839 Browser* browser = chrome::FindBrowserWithWebContents( 842 Browser* browser = chrome::FindBrowserWithWebContents(
840 web_ui()->GetWebContents()); 843 web_ui()->GetWebContents());
841 extension_uninstall_dialog_.reset( 844 extension_uninstall_dialog_.reset(
842 ExtensionUninstallDialog::Create(extension_service_->profile(), 845 ExtensionUninstallDialog::Create(extension_service_->profile(),
843 browser, this)); 846 browser, this));
844 } 847 }
845 return extension_uninstall_dialog_.get(); 848 return extension_uninstall_dialog_.get();
846 } 849 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698