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

Side by Side Diff: chrome/browser/ui/webui/settings/extension_control_handler.cc

Issue 2509543002: MD Settings: create a shared handler/browser proxy to control extensions (Closed)
Patch Set: merge Created 4 years, 1 month 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/webui/settings/extension_control_handler.h"
6
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "base/logging.h"
10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/profiles/profile.h"
12 #include "content/public/browser/web_ui.h"
13 #include "extensions/browser/extension_system.h"
14 #include "extensions/common/extension.h"
15
16 namespace settings {
17
18 ExtensionControlHandler::ExtensionControlHandler() {}
19 ExtensionControlHandler::~ExtensionControlHandler() {}
20
21 void ExtensionControlHandler::RegisterMessages() {
22 web_ui()->RegisterMessageCallback("disableExtension",
23 base::Bind(&ExtensionControlHandler::HandleDisableExtension,
24 base::Unretained(this)));
25 }
26
27 void ExtensionControlHandler::HandleDisableExtension(
28 const base::ListValue* args) {
29 std::string extension_id;
30 CHECK(args->GetString(0, &extension_id));
31 ExtensionService* extension_service = extensions::ExtensionSystem::Get(
32 Profile::FromWebUI(web_ui()))->extension_service();
33 DCHECK(extension_service);
34 extension_service->DisableExtension(
35 extension_id, extensions::Extension::DISABLE_USER_ACTION);
36 }
37
38 } // namespace settings
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/extension_control_handler.h ('k') | chrome/browser/ui/webui/settings/md_settings_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698