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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 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_uninstall_dialog.h" 5 #include "chrome/browser/extensions/extension_uninstall_dialog.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/extensions/image_loader.h" 10 #include "chrome/browser/extensions/image_loader.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 ExtensionUninstallDialog::ExtensionUninstallDialog( 50 ExtensionUninstallDialog::ExtensionUninstallDialog(
51 Profile* profile, 51 Profile* profile,
52 Browser* browser, 52 Browser* browser,
53 ExtensionUninstallDialog::Delegate* delegate) 53 ExtensionUninstallDialog::Delegate* delegate)
54 : profile_(profile), 54 : profile_(profile),
55 browser_(browser), 55 browser_(browser),
56 delegate_(delegate), 56 delegate_(delegate),
57 extension_(NULL), 57 extension_(NULL),
58 state_(kImageIsLoading), 58 state_(kImageIsLoading),
59 ui_loop_(MessageLoop::current()) { 59 ui_loop_(base::MessageLoop::current()) {
60 if (browser) { 60 if (browser) {
61 registrar_.Add(this, 61 registrar_.Add(this,
62 chrome::NOTIFICATION_BROWSER_CLOSED, 62 chrome::NOTIFICATION_BROWSER_CLOSED,
63 content::Source<Browser>(browser)); 63 content::Source<Browser>(browser));
64 } 64 }
65 } 65 }
66 66
67 ExtensionUninstallDialog::~ExtensionUninstallDialog() { 67 ExtensionUninstallDialog::~ExtensionUninstallDialog() {
68 } 68 }
69 69
70 void ExtensionUninstallDialog::ConfirmUninstall( 70 void ExtensionUninstallDialog::ConfirmUninstall(
71 const extensions::Extension* extension) { 71 const extensions::Extension* extension) {
72 DCHECK(ui_loop_ == MessageLoop::current()); 72 DCHECK(ui_loop_ == base::MessageLoop::current());
73 extension_ = extension; 73 extension_ = extension;
74 extensions::ExtensionResource image = extensions::IconsInfo::GetIconResource( 74 extensions::ExtensionResource image = extensions::IconsInfo::GetIconResource(
75 extension_, 75 extension_,
76 extension_misc::EXTENSION_ICON_LARGE, 76 extension_misc::EXTENSION_ICON_LARGE,
77 ExtensionIconSet::MATCH_BIGGER); 77 ExtensionIconSet::MATCH_BIGGER);
78 // Load the icon whose pixel size is large enough to be displayed under 78 // Load the icon whose pixel size is large enough to be displayed under
79 // maximal supported scale factor. UI code will scale the icon down if needed. 79 // maximal supported scale factor. UI code will scale the icon down if needed.
80 int pixel_size = GetSizeForMaxScaleFactor(kIconSize); 80 int pixel_size = GetSizeForMaxScaleFactor(kIconSize);
81 81
82 // Load the image asynchronously. The response will be sent to OnImageLoaded. 82 // Load the image asynchronously. The response will be sent to OnImageLoaded.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 browser_ = NULL; 124 browser_ = NULL;
125 // If the browser is closed while waiting for the image, we need to send a 125 // If the browser is closed while waiting for the image, we need to send a
126 // "cancel" event here, because there will not be another opportunity to 126 // "cancel" event here, because there will not be another opportunity to
127 // notify the delegate of the cancellation as we won't open the dialog. 127 // notify the delegate of the cancellation as we won't open the dialog.
128 if (state_ == kImageIsLoading) { 128 if (state_ == kImageIsLoading) {
129 state_ = kBrowserIsClosing; 129 state_ = kBrowserIsClosing;
130 delegate_->ExtensionUninstallCanceled(); 130 delegate_->ExtensionUninstallCanceled();
131 } 131 }
132 } 132 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_ui_unittest.cc ('k') | chrome/browser/extensions/extensions_quota_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698