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

Side by Side Diff: chrome/browser/extensions/extension_management_api.cc

Issue 10388252: Refactoring ExtenionInstallUI to abstract the Browser references. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor clean-ups 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 | Annotate | Revision Log
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/extension_management_api.h" 5 #include "chrome/browser/extensions/extension_management_api.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 bool currently_enabled = service()->IsExtensionEnabled(extension_id_); 375 bool currently_enabled = service()->IsExtensionEnabled(extension_id_);
376 376
377 if (!currently_enabled && enable) { 377 if (!currently_enabled && enable) {
378 ExtensionPrefs* prefs = service()->extension_prefs(); 378 ExtensionPrefs* prefs = service()->extension_prefs();
379 if (prefs->DidExtensionEscalatePermissions(extension_id_)) { 379 if (prefs->DidExtensionEscalatePermissions(extension_id_)) {
380 if (!user_gesture()) { 380 if (!user_gesture()) {
381 error_ = keys::kGestureNeededForEscalationError; 381 error_ = keys::kGestureNeededForEscalationError;
382 return false; 382 return false;
383 } 383 }
384 AddRef(); // Matched in InstallUIProceed/InstallUIAbort 384 AddRef(); // Matched in InstallUIProceed/InstallUIAbort
385 install_ui_.reset(new ExtensionInstallUI(profile_)); 385 install_ui_.reset(new ExtensionInstallPrompt(profile_));
386 install_ui_->ConfirmReEnable(this, extension); 386 install_ui_->ConfirmReEnable(this, extension);
387 return true; 387 return true;
388 } 388 }
389 service()->EnableExtension(extension_id_); 389 service()->EnableExtension(extension_id_);
390 } else if (currently_enabled && !enable) { 390 } else if (currently_enabled && !enable) {
391 service()->DisableExtension(extension_id_, Extension::DISABLE_USER_ACTION); 391 service()->DisableExtension(extension_id_, Extension::DISABLE_USER_ACTION);
392 } 392 }
393 393
394 BrowserThread::PostTask( 394 BrowserThread::PostTask(
395 BrowserThread::UI, 395 BrowserThread::UI,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 ExtensionService* service = profile->GetExtensionService(); 499 ExtensionService* service = profile->GetExtensionService();
500 args.Append(CreateExtensionInfo(*extension, service)); 500 args.Append(CreateExtensionInfo(*extension, service));
501 } 501 }
502 502
503 std::string args_json; 503 std::string args_json;
504 base::JSONWriter::Write(&args, &args_json); 504 base::JSONWriter::Write(&args, &args_json);
505 505
506 profile->GetExtensionEventRouter()->DispatchEventToRenderers( 506 profile->GetExtensionEventRouter()->DispatchEventToRenderers(
507 event_name, args_json, NULL, GURL()); 507 event_name, args_json, NULL, GURL());
508 } 508 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698