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

Side by Side Diff: chrome/browser/extensions/api/management/management_api.cc

Issue 508263003: Add getSelf method to management API to use without the "management" permission. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
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/extensions/api/management/management_api.h" 5 #include "chrome/browser/extensions/api/management/management_api.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 return false; 319 return false;
320 } 320 }
321 321
322 scoped_ptr<management::ExtensionInfo> info = 322 scoped_ptr<management::ExtensionInfo> info =
323 CreateExtensionInfo(*extension, ExtensionSystem::Get(GetProfile())); 323 CreateExtensionInfo(*extension, ExtensionSystem::Get(GetProfile()));
324 results_ = management::Get::Results::Create(*info); 324 results_ = management::Get::Results::Create(*info);
325 325
326 return true; 326 return true;
327 } 327 }
328 328
329 bool ManagementGetSelfFunction::RunSync() {
330 scoped_ptr<management::ExtensionInfo> info =
331 CreateExtensionInfo(*extension_, ExtensionSystem::Get(GetProfile()));
332 results_ = management::Get::Results::Create(*info);
333
334 return true;
335 }
336
329 bool ManagementGetPermissionWarningsByIdFunction::RunSync() { 337 bool ManagementGetPermissionWarningsByIdFunction::RunSync() {
330 scoped_ptr<management::GetPermissionWarningsById::Params> params( 338 scoped_ptr<management::GetPermissionWarningsById::Params> params(
331 management::GetPermissionWarningsById::Params::Create(*args_)); 339 management::GetPermissionWarningsById::Params::Create(*args_));
332 EXTENSION_FUNCTION_VALIDATE(params.get()); 340 EXTENSION_FUNCTION_VALIDATE(params.get());
333 341
334 const Extension* extension = service()->GetExtensionById(params->id, true); 342 const Extension* extension = service()->GetExtensionById(params->id, true);
335 if (!extension) { 343 if (!extension) {
336 error_ = ErrorUtils::FormatErrorMessage(keys::kNoExtensionError, 344 error_ = ErrorUtils::FormatErrorMessage(keys::kNoExtensionError,
337 params->id); 345 params->id);
338 return false; 346 return false;
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 ManagementAPI::GetFactoryInstance() { 1013 ManagementAPI::GetFactoryInstance() {
1006 return g_factory.Pointer(); 1014 return g_factory.Pointer();
1007 } 1015 }
1008 1016
1009 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { 1017 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) {
1010 management_event_router_.reset(new ManagementEventRouter(browser_context_)); 1018 management_event_router_.reset(new ManagementEventRouter(browser_context_));
1011 EventRouter::Get(browser_context_)->UnregisterObserver(this); 1019 EventRouter::Get(browser_context_)->UnregisterObserver(this);
1012 } 1020 }
1013 1021
1014 } // namespace extensions 1022 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698