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

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

Issue 10452009: Improve the UI for disabling off-store extension install. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments, fixed tests 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/webstore_installer.h" 5 #include "chrome/browser/extensions/webstore_installer.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/rand_util.h" 11 #include "base/rand_util.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/download/chrome_download_manager_delegate.h" 17 #include "chrome/browser/download/download_crx_util.h"
18 #include "chrome/browser/download/download_prefs.h" 18 #include "chrome/browser/download/download_prefs.h"
19 #include "chrome/browser/download/download_util.h" 19 #include "chrome/browser/download/download_util.h"
20 #include "chrome/browser/extensions/crx_installer.h" 20 #include "chrome/browser/extensions/crx_installer.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/ui/browser_list.h" 22 #include "chrome/browser/ui/browser_list.h"
23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
24 #include "chrome/browser/ui/tabs/tab_strip_model.h" 24 #include "chrome/browser/ui/tabs/tab_strip_model.h"
25 #include "chrome/common/chrome_notification_types.h" 25 #include "chrome/common/chrome_notification_types.h"
26 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
27 #include "chrome/common/extensions/extension.h" 27 #include "chrome/common/extensions/extension.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 break; 280 break;
281 case DownloadItem::INTERRUPTED: 281 case DownloadItem::INTERRUPTED:
282 ReportFailure(kDownloadInterruptedError); 282 ReportFailure(kDownloadInterruptedError);
283 break; 283 break;
284 case DownloadItem::REMOVING: 284 case DownloadItem::REMOVING:
285 download_item_->RemoveObserver(this); 285 download_item_->RemoveObserver(this);
286 download_item_ = NULL; 286 download_item_ = NULL;
287 break; 287 break;
288 case DownloadItem::COMPLETE: 288 case DownloadItem::COMPLETE:
289 // Wait for other notifications if the download is really an extension. 289 // Wait for other notifications if the download is really an extension.
290 if (!ChromeDownloadManagerDelegate::IsExtensionDownload(download)) 290 if (!download_crx_util::IsExtensionDownload(*download))
291 ReportFailure(kInvalidDownloadError); 291 ReportFailure(kInvalidDownloadError);
292 break; 292 break;
293 default: 293 default:
294 // Continue listening if the download is not in one of the above states. 294 // Continue listening if the download is not in one of the above states.
295 break; 295 break;
296 } 296 }
297 } 297 }
298 298
299 void WebstoreInstaller::OnDownloadOpened(DownloadItem* download) { 299 void WebstoreInstaller::OnDownloadOpened(DownloadItem* download) {
300 CHECK_EQ(download_item_, download); 300 CHECK_EQ(download_item_, download);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 334 }
335 335
336 void WebstoreInstaller::ReportSuccess() { 336 void WebstoreInstaller::ReportSuccess() {
337 if (delegate_) { 337 if (delegate_) {
338 delegate_->OnExtensionInstallSuccess(id_); 338 delegate_->OnExtensionInstallSuccess(id_);
339 delegate_ = NULL; 339 delegate_ = NULL;
340 } 340 }
341 341
342 Release(); // Balanced in Start(). 342 Release(); // Balanced in Start().
343 } 343 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_install_ui_browsertest.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698