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

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

Issue 2360073002: [Extensions] Isolate ExtensionFunction results_ and error_ (Closed)
Patch Set: errorwithargs Created 4 years, 2 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 "extensions/browser/api/management/management_api.h" 5 #include "extensions/browser/api/management/management_api.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 671
672 if (auto_confirm_for_test != DO_NOT_SKIP) { 672 if (auto_confirm_for_test != DO_NOT_SKIP) {
673 // Matched with a Release() in OnCloseShortcutPrompt(). 673 // Matched with a Release() in OnCloseShortcutPrompt().
674 AddRef(); 674 AddRef();
675 675
676 OnCloseShortcutPrompt(auto_confirm_for_test == PROCEED); 676 OnCloseShortcutPrompt(auto_confirm_for_test == PROCEED);
677 677
678 return true; 678 return true;
679 } 679 }
680 680
681 std::string error;
681 if (ManagementAPI::GetFactoryInstance() 682 if (ManagementAPI::GetFactoryInstance()
682 ->Get(browser_context()) 683 ->Get(browser_context())
683 ->GetDelegate() 684 ->GetDelegate()
684 ->CreateAppShortcutFunctionDelegate(this, extension)) { 685 ->CreateAppShortcutFunctionDelegate(this, extension, &error)) {
685 // Matched with a Release() in OnCloseShortcutPrompt(). 686 // Matched with a Release() in OnCloseShortcutPrompt().
686 AddRef(); 687 AddRef();
688 } else {
689 SetError(error);
687 } 690 }
688 691
689 // Response is sent async in OnCloseShortcutPrompt(). 692 // Response is sent async in OnCloseShortcutPrompt().
690 return true; 693 return true;
691 } 694 }
692 695
693 ExtensionFunction::ResponseAction ManagementSetLaunchTypeFunction::Run() { 696 ExtensionFunction::ResponseAction ManagementSetLaunchTypeFunction::Run() {
694 if (!user_gesture()) 697 if (!user_gesture())
695 return RespondNow(Error(keys::kGestureNeededForSetLaunchTypeError)); 698 return RespondNow(Error(keys::kGestureNeededForSetLaunchTypeError));
696 699
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 ManagementAPI::GetFactoryInstance() { 884 ManagementAPI::GetFactoryInstance() {
882 return g_factory.Pointer(); 885 return g_factory.Pointer();
883 } 886 }
884 887
885 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { 888 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) {
886 management_event_router_.reset(new ManagementEventRouter(browser_context_)); 889 management_event_router_.reset(new ManagementEventRouter(browser_context_));
887 EventRouter::Get(browser_context_)->UnregisterObserver(this); 890 EventRouter::Get(browser_context_)->UnregisterObserver(this);
888 } 891 }
889 892
890 } // namespace extensions 893 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698