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

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: Synced + mac fix 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 | 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 bool currently_enabled = service()->IsExtensionEnabled(extension_id_); 400 bool currently_enabled = service()->IsExtensionEnabled(extension_id_);
401 401
402 if (!currently_enabled && enable) { 402 if (!currently_enabled && enable) {
403 ExtensionPrefs* prefs = service()->extension_prefs(); 403 ExtensionPrefs* prefs = service()->extension_prefs();
404 if (prefs->DidExtensionEscalatePermissions(extension_id_)) { 404 if (prefs->DidExtensionEscalatePermissions(extension_id_)) {
405 if (!user_gesture()) { 405 if (!user_gesture()) {
406 error_ = keys::kGestureNeededForEscalationError; 406 error_ = keys::kGestureNeededForEscalationError;
407 return false; 407 return false;
408 } 408 }
409 AddRef(); // Matched in InstallUIProceed/InstallUIAbort 409 AddRef(); // Matched in InstallUIProceed/InstallUIAbort
410 install_ui_.reset(new ExtensionInstallUI(profile_)); 410 install_prompt_.reset(new ExtensionInstallPrompt(profile_));
411 install_ui_->ConfirmReEnable(this, extension); 411 install_prompt_->ConfirmReEnable(this, extension);
412 return true; 412 return true;
413 } 413 }
414 service()->EnableExtension(extension_id_); 414 service()->EnableExtension(extension_id_);
415 } else if (currently_enabled && !enable) { 415 } else if (currently_enabled && !enable) {
416 service()->DisableExtension(extension_id_, Extension::DISABLE_USER_ACTION); 416 service()->DisableExtension(extension_id_, Extension::DISABLE_USER_ACTION);
417 } 417 }
418 418
419 BrowserThread::PostTask( 419 BrowserThread::PostTask(
420 BrowserThread::UI, 420 BrowserThread::UI,
421 FROM_HERE, 421 FROM_HERE,
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 ExtensionService* service = profile->GetExtensionService(); 583 ExtensionService* service = profile->GetExtensionService();
584 args.Append(CreateExtensionInfo(*extension, service)); 584 args.Append(CreateExtensionInfo(*extension, service));
585 } 585 }
586 586
587 std::string args_json; 587 std::string args_json;
588 base::JSONWriter::Write(&args, &args_json); 588 base::JSONWriter::Write(&args, &args_json);
589 589
590 profile->GetExtensionEventRouter()->DispatchEventToRenderers( 590 profile->GetExtensionEventRouter()->DispatchEventToRenderers(
591 event_name, args_json, NULL, GURL()); 591 event_name, args_json, NULL, GURL());
592 } 592 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management_api.h ('k') | chrome/browser/extensions/extension_navigation_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698