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

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

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 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/webui/ntp/app_launcher_handler.h" 5 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "content/public/browser/web_ui.h" 45 #include "content/public/browser/web_ui.h"
46 #include "googleurl/src/gurl.h" 46 #include "googleurl/src/gurl.h"
47 #include "grit/browser_resources.h" 47 #include "grit/browser_resources.h"
48 #include "grit/generated_resources.h" 48 #include "grit/generated_resources.h"
49 #include "net/base/escape.h" 49 #include "net/base/escape.h"
50 #include "ui/base/animation/animation.h" 50 #include "ui/base/animation/animation.h"
51 #include "ui/base/l10n/l10n_util.h" 51 #include "ui/base/l10n/l10n_util.h"
52 #include "ui/gfx/codec/png_codec.h" 52 #include "ui/gfx/codec/png_codec.h"
53 53
54 using content::WebContents; 54 using content::WebContents;
55 using extensions::Extension;
55 56
56 namespace { 57 namespace {
57 58
58 const net::UnescapeRule::Type kUnescapeRules = 59 const net::UnescapeRule::Type kUnescapeRules =
59 net::UnescapeRule::NORMAL | net::UnescapeRule::URL_SPECIAL_CHARS; 60 net::UnescapeRule::NORMAL | net::UnescapeRule::URL_SPECIAL_CHARS;
60 61
61 extension_misc::AppLaunchBucket ParseLaunchSource( 62 extension_misc::AppLaunchBucket ParseLaunchSource(
62 const std::string& launch_source) { 63 const std::string& launch_source) {
63 int bucket_num = extension_misc::APP_LAUNCH_BUCKET_INVALID; 64 int bucket_num = extension_misc::APP_LAUNCH_BUCKET_INVALID;
64 base::StringToInt(launch_source, &bucket_num); 65 base::StringToInt(launch_source, &bucket_num);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 attempted_bookmark_app_install_)); 267 attempted_bookmark_app_install_));
267 attempted_bookmark_app_install_ = false; 268 attempted_bookmark_app_install_ = false;
268 web_ui()->CallJavascriptFunction( 269 web_ui()->CallJavascriptFunction(
269 "ntp.appAdded", *app_info, *highlight); 270 "ntp.appAdded", *app_info, *highlight);
270 } 271 }
271 272
272 break; 273 break;
273 } 274 }
274 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { 275 case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
275 const Extension* extension = 276 const Extension* extension =
276 content::Details<UnloadedExtensionInfo>(details)->extension; 277 content::Details<extensions::UnloadedExtensionInfo>(
278 details)->extension;
277 if (!extension->is_app()) 279 if (!extension->is_app())
278 return; 280 return;
279 281
280 scoped_ptr<DictionaryValue> app_info(GetAppInfo(extension)); 282 scoped_ptr<DictionaryValue> app_info(GetAppInfo(extension));
281 scoped_ptr<base::FundamentalValue> uninstall_value( 283 scoped_ptr<base::FundamentalValue> uninstall_value(
282 Value::CreateBooleanValue( 284 Value::CreateBooleanValue(
283 content::Details<UnloadedExtensionInfo>(details)->reason == 285 content::Details<extensions::UnloadedExtensionInfo>(
284 extension_misc::UNLOAD_REASON_UNINSTALL)); 286 details)->reason == extension_misc::UNLOAD_REASON_UNINSTALL));
285 if (app_info.get()) { 287 if (app_info.get()) {
286 scoped_ptr<base::FundamentalValue> from_page( 288 scoped_ptr<base::FundamentalValue> from_page(
287 Value::CreateBooleanValue(!extension_id_prompting_.empty())); 289 Value::CreateBooleanValue(!extension_id_prompting_.empty()));
288 web_ui()->CallJavascriptFunction( 290 web_ui()->CallJavascriptFunction(
289 "ntp.appRemoved", *app_info, *uninstall_value, *from_page); 291 "ntp.appRemoved", *app_info, *uninstall_value, *from_page);
290 } 292 }
291 break; 293 break;
292 } 294 }
293 case chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED: { 295 case chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED: {
294 const std::string* id = 296 const std::string* id =
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 ExtensionInstallUI* AppLauncherHandler::GetExtensionInstallUI() { 977 ExtensionInstallUI* AppLauncherHandler::GetExtensionInstallUI() {
976 if (!extension_install_ui_.get()) { 978 if (!extension_install_ui_.get()) {
977 extension_install_ui_.reset( 979 extension_install_ui_.reset(
978 new ExtensionInstallUI(Profile::FromWebUI(web_ui()))); 980 new ExtensionInstallUI(Profile::FromWebUI(web_ui())));
979 } 981 }
980 return extension_install_ui_.get(); 982 return extension_install_ui_.get();
981 } 983 }
982 984
983 void AppLauncherHandler::UninstallDefaultApps() { 985 void AppLauncherHandler::UninstallDefaultApps() {
984 AppsPromo* apps_promo = extension_service_->apps_promo(); 986 AppsPromo* apps_promo = extension_service_->apps_promo();
985 const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); 987 const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps();
986 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); 988 for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin();
987 iter != app_ids.end(); ++iter) { 989 iter != app_ids.end(); ++iter) {
988 if (extension_service_->GetExtensionById(*iter, true)) 990 if (extension_service_->GetExtensionById(*iter, true))
989 extension_service_->UninstallExtension(*iter, false, NULL); 991 extension_service_->UninstallExtension(*iter, false, NULL);
990 } 992 }
991 } 993 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/app_launcher_handler.h ('k') | chrome/browser/ui/webui/ntp/favicon_webui_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698