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

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

Issue 12316077: 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, 9 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 "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 15 matching lines...) Expand all
26 #include "chrome/browser/profiles/profile.h" 26 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/ui/browser_finder.h" 27 #include "chrome/browser/ui/browser_finder.h"
28 #include "chrome/browser/ui/browser_tabstrip.h" 28 #include "chrome/browser/ui/browser_tabstrip.h"
29 #include "chrome/browser/ui/browser_window.h" 29 #include "chrome/browser/ui/browser_window.h"
30 #include "chrome/browser/ui/extensions/application_launch.h" 30 #include "chrome/browser/ui/extensions/application_launch.h"
31 #include "chrome/browser/ui/extensions/extension_enable_flow.h" 31 #include "chrome/browser/ui/extensions/extension_enable_flow.h"
32 #include "chrome/browser/ui/tabs/tab_strip_model.h" 32 #include "chrome/browser/ui/tabs/tab_strip_model.h"
33 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" 33 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
34 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 34 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
35 #include "chrome/common/chrome_notification_types.h" 35 #include "chrome/common/chrome_notification_types.h"
36 #include "chrome/common/extensions/app_launcher_info.h"
36 #include "chrome/common/extensions/extension.h" 37 #include "chrome/common/extensions/extension.h"
37 #include "chrome/common/extensions/extension_constants.h" 38 #include "chrome/common/extensions/extension_constants.h"
38 #include "chrome/common/extensions/extension_icon_set.h" 39 #include "chrome/common/extensions/extension_icon_set.h"
39 #include "chrome/common/extensions/extension_resource.h" 40 #include "chrome/common/extensions/extension_resource.h"
40 #include "chrome/common/pref_names.h" 41 #include "chrome/common/pref_names.h"
41 #include "chrome/common/url_constants.h" 42 #include "chrome/common/url_constants.h"
42 #include "chrome/common/web_apps.h" 43 #include "chrome/common/web_apps.h"
43 #include "components/user_prefs/pref_registry_syncable.h" 44 #include "components/user_prefs/pref_registry_syncable.h"
44 #include "content/public/browser/notification_service.h" 45 #include "content/public/browser/notification_service.h"
45 #include "content/public/browser/web_ui.h" 46 #include "content/public/browser/web_ui.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 void AppLauncherHandler::CreateAppInfo( 91 void AppLauncherHandler::CreateAppInfo(
91 const Extension* extension, 92 const Extension* extension,
92 ExtensionService* service, 93 ExtensionService* service,
93 DictionaryValue* value) { 94 DictionaryValue* value) {
94 value->Clear(); 95 value->Clear();
95 96
96 // The Extension class 'helpfully' wraps bidi control characters that 97 // The Extension class 'helpfully' wraps bidi control characters that
97 // impede our ability to determine directionality. 98 // impede our ability to determine directionality.
98 string16 name = UTF8ToUTF16(extension->name()); 99 string16 name = UTF8ToUTF16(extension->name());
99 base::i18n::UnadjustStringForLocaleDirection(&name); 100 base::i18n::UnadjustStringForLocaleDirection(&name);
100 NewTabUI::SetUrlTitleAndDirection(value, name, extension->GetFullLaunchURL()); 101 NewTabUI::SetUrlTitleAndDirection(
102 value, name, extensions::AppLauncherInfo::GetFullLaunchURL(extension));
101 103
102 bool enabled = service->IsExtensionEnabled(extension->id()) && 104 bool enabled = service->IsExtensionEnabled(extension->id()) &&
103 !service->GetTerminatedExtension(extension->id()); 105 !service->GetTerminatedExtension(extension->id());
104 extension->GetBasicInfo(enabled, value); 106 extension->GetBasicInfo(enabled, value);
105 107
106 value->SetBoolean("mayDisable", extensions::ExtensionSystem::Get( 108 value->SetBoolean("mayDisable", extensions::ExtensionSystem::Get(
107 service->profile())->management_policy()->UserMayModifySettings( 109 service->profile())->management_policy()->UserMayModifySettings(
108 extension, NULL)); 110 extension, NULL));
109 111
110 bool icon_big_exists = true; 112 bool icon_big_exists = true;
111 // Instead of setting grayscale here, we do it in apps_page.js. 113 // Instead of setting grayscale here, we do it in apps_page.js.
112 GURL icon_big = 114 GURL icon_big =
113 ExtensionIconSource::GetIconURL(extension, 115 ExtensionIconSource::GetIconURL(extension,
114 extension_misc::EXTENSION_ICON_LARGE, 116 extension_misc::EXTENSION_ICON_LARGE,
115 ExtensionIconSet::MATCH_BIGGER, 117 ExtensionIconSet::MATCH_BIGGER,
116 false, &icon_big_exists); 118 false, &icon_big_exists);
117 value->SetString("icon_big", icon_big.spec()); 119 value->SetString("icon_big", icon_big.spec());
118 value->SetBoolean("icon_big_exists", icon_big_exists); 120 value->SetBoolean("icon_big_exists", icon_big_exists);
119 bool icon_small_exists = true; 121 bool icon_small_exists = true;
120 GURL icon_small = 122 GURL icon_small =
121 ExtensionIconSource::GetIconURL(extension, 123 ExtensionIconSource::GetIconURL(extension,
122 extension_misc::EXTENSION_ICON_BITTY, 124 extension_misc::EXTENSION_ICON_BITTY,
123 ExtensionIconSet::MATCH_BIGGER, 125 ExtensionIconSet::MATCH_BIGGER,
124 false, &icon_small_exists); 126 false, &icon_small_exists);
125 value->SetString("icon_small", icon_small.spec()); 127 value->SetString("icon_small", icon_small.spec());
126 value->SetBoolean("icon_small_exists", icon_small_exists); 128 value->SetBoolean("icon_small_exists", icon_small_exists);
127 value->SetInteger("launch_container", extension->launch_container()); 129 value->SetInteger("launch_container",
130 extensions::AppLauncherInfo::GetLaunchContainer(extension));
128 ExtensionPrefs* prefs = service->extension_prefs(); 131 ExtensionPrefs* prefs = service->extension_prefs();
129 value->SetInteger("launch_type", 132 value->SetInteger("launch_type",
130 prefs->GetLaunchType(extension, 133 prefs->GetLaunchType(extension,
131 ExtensionPrefs::LAUNCH_DEFAULT)); 134 ExtensionPrefs::LAUNCH_DEFAULT));
132 value->SetBoolean("is_component", 135 value->SetBoolean("is_component",
133 extension->location() == extensions::Manifest::COMPONENT); 136 extension->location() == extensions::Manifest::COMPONENT);
134 value->SetBoolean("is_webstore", 137 value->SetBoolean("is_webstore",
135 extension->id() == extension_misc::kWebStoreAppId); 138 extension->id() == extension_misc::kWebStoreAppId);
136 139
137 ExtensionSorting* sorting = prefs->extension_sorting(); 140 ExtensionSorting* sorting = prefs->extension_sorting();
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { 814 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() {
812 if (!extension_uninstall_dialog_.get()) { 815 if (!extension_uninstall_dialog_.get()) {
813 Browser* browser = chrome::FindBrowserWithWebContents( 816 Browser* browser = chrome::FindBrowserWithWebContents(
814 web_ui()->GetWebContents()); 817 web_ui()->GetWebContents());
815 extension_uninstall_dialog_.reset( 818 extension_uninstall_dialog_.reset(
816 ExtensionUninstallDialog::Create(extension_service_->profile(), 819 ExtensionUninstallDialog::Create(extension_service_->profile(),
817 browser, this)); 820 browser, this));
818 } 821 }
819 return extension_uninstall_dialog_.get(); 822 return extension_uninstall_dialog_.get();
820 } 823 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698