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

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

Issue 10649003: Move each permission classes to its own files in extensions/permissions (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase on HEAD Created 8 years, 6 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "content/public/browser/web_ui.h" 46 #include "content/public/browser/web_ui.h"
47 #include "googleurl/src/gurl.h" 47 #include "googleurl/src/gurl.h"
48 #include "grit/browser_resources.h" 48 #include "grit/browser_resources.h"
49 #include "grit/generated_resources.h" 49 #include "grit/generated_resources.h"
50 #include "net/base/escape.h" 50 #include "net/base/escape.h"
51 #include "ui/base/animation/animation.h" 51 #include "ui/base/animation/animation.h"
52 #include "ui/base/l10n/l10n_util.h" 52 #include "ui/base/l10n/l10n_util.h"
53 #include "ui/gfx/codec/png_codec.h" 53 #include "ui/gfx/codec/png_codec.h"
54 54
55 using content::WebContents; 55 using content::WebContents;
56 using extensions::APIPermission;
56 using extensions::Extension; 57 using extensions::Extension;
57 58
58 namespace { 59 namespace {
59 60
60 const net::UnescapeRule::Type kUnescapeRules = 61 const net::UnescapeRule::Type kUnescapeRules =
61 net::UnescapeRule::NORMAL | net::UnescapeRule::URL_SPECIAL_CHARS; 62 net::UnescapeRule::NORMAL | net::UnescapeRule::URL_SPECIAL_CHARS;
62 63
63 extension_misc::AppLaunchBucket ParseLaunchSource( 64 extension_misc::AppLaunchBucket ParseLaunchSource(
64 const std::string& launch_source) { 65 const std::string& launch_source) {
65 int bucket_num = extension_misc::APP_LAUNCH_BUCKET_INVALID; 66 int bucket_num = extension_misc::APP_LAUNCH_BUCKET_INVALID;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 value->SetInteger("launch_container", extension->launch_container()); 140 value->SetInteger("launch_container", extension->launch_container());
140 ExtensionPrefs* prefs = service->extension_prefs(); 141 ExtensionPrefs* prefs = service->extension_prefs();
141 value->SetInteger("launch_type", 142 value->SetInteger("launch_type",
142 prefs->GetLaunchType(extension->id(), 143 prefs->GetLaunchType(extension->id(),
143 ExtensionPrefs::LAUNCH_DEFAULT)); 144 ExtensionPrefs::LAUNCH_DEFAULT));
144 value->SetBoolean("is_component", 145 value->SetBoolean("is_component",
145 extension->location() == Extension::COMPONENT); 146 extension->location() == Extension::COMPONENT);
146 value->SetBoolean("is_webstore", 147 value->SetBoolean("is_webstore",
147 extension->id() == extension_misc::kWebStoreAppId); 148 extension->id() == extension_misc::kWebStoreAppId);
148 149
149 if (extension->HasAPIPermission(ExtensionAPIPermission::kAppNotifications)) { 150 if (extension->HasAPIPermission(APIPermission::kAppNotifications)) {
150 value->SetBoolean("notifications_disabled", 151 value->SetBoolean("notifications_disabled",
151 prefs->IsAppNotificationDisabled(extension->id())); 152 prefs->IsAppNotificationDisabled(extension->id()));
152 } 153 }
153 154
154 if (notification) 155 if (notification)
155 value->Set("notification", SerializeNotification(*notification)); 156 value->Set("notification", SerializeNotification(*notification));
156 157
157 ExtensionSorting* sorting = prefs->extension_sorting(); 158 ExtensionSorting* sorting = prefs->extension_sorting();
158 StringOrdinal page_ordinal = sorting->GetPageOrdinal(extension->id()); 159 StringOrdinal page_ordinal = sorting->GetPageOrdinal(extension->id());
159 if (!page_ordinal.IsValid()) { 160 if (!page_ordinal.IsValid()) {
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 993
993 void AppLauncherHandler::UninstallDefaultApps() { 994 void AppLauncherHandler::UninstallDefaultApps() {
994 AppsPromo* apps_promo = extension_service_->apps_promo(); 995 AppsPromo* apps_promo = extension_service_->apps_promo();
995 const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps(); 996 const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps();
996 for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin(); 997 for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin();
997 iter != app_ids.end(); ++iter) { 998 iter != app_ids.end(); ++iter) {
998 if (extension_service_->GetExtensionById(*iter, true)) 999 if (extension_service_->GetExtensionById(*iter, true))
999 extension_service_->UninstallExtension(*iter, false, NULL); 1000 extension_service_->UninstallExtension(*iter, false, NULL);
1000 } 1001 }
1001 } 1002 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698