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

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

Issue 481433005: Extensions: Move id_util functions to crx_file component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert last patchset. function returns Extension* and can't use an assert. Created 6 years, 4 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_standalone_installer.h" 5 #include "chrome/browser/extensions/webstore_standalone_installer.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "base/version.h" 8 #include "base/version.h"
9 #include "chrome/browser/extensions/crx_installer.h" 9 #include "chrome/browser/extensions/crx_installer.h"
10 #include "chrome/browser/extensions/extension_install_prompt.h" 10 #include "chrome/browser/extensions/extension_install_prompt.h"
11 #include "chrome/browser/extensions/extension_install_ui.h" 11 #include "chrome/browser/extensions/extension_install_ui.h"
12 #include "chrome/browser/extensions/extension_install_ui_util.h" 12 #include "chrome/browser/extensions/extension_install_ui_util.h"
13 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/extensions/install_tracker.h" 14 #include "chrome/browser/extensions/install_tracker.h"
15 #include "chrome/browser/extensions/webstore_data_fetcher.h" 15 #include "chrome/browser/extensions/webstore_data_fetcher.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "components/crx_file/id_util.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
18 #include "extensions/browser/extension_prefs.h" 19 #include "extensions/browser/extension_prefs.h"
19 #include "extensions/browser/extension_registry.h" 20 #include "extensions/browser/extension_registry.h"
20 #include "extensions/browser/extension_system.h" 21 #include "extensions/browser/extension_system.h"
21 #include "extensions/browser/extension_util.h" 22 #include "extensions/browser/extension_util.h"
22 #include "extensions/common/extension.h" 23 #include "extensions/common/extension.h"
23 #include "url/gurl.h" 24 #include "url/gurl.h"
24 25
25 using content::WebContents; 26 using content::WebContents;
26 27
(...skipping 21 matching lines...) Expand all
48 average_rating_(0.0), 49 average_rating_(0.0),
49 rating_count_(0) { 50 rating_count_(0) {
50 } 51 }
51 52
52 void WebstoreStandaloneInstaller::BeginInstall() { 53 void WebstoreStandaloneInstaller::BeginInstall() {
53 // Add a ref to keep this alive for WebstoreDataFetcher. 54 // Add a ref to keep this alive for WebstoreDataFetcher.
54 // All code paths from here eventually lead to either CompleteInstall or 55 // All code paths from here eventually lead to either CompleteInstall or
55 // AbortInstall, which both release this ref. 56 // AbortInstall, which both release this ref.
56 AddRef(); 57 AddRef();
57 58
58 if (!Extension::IdIsValid(id_)) { 59 if (!crx_file::id_util::IdIsValid(id_)) {
59 CompleteInstall(webstore_install::INVALID_ID, kInvalidWebstoreItemId); 60 CompleteInstall(webstore_install::INVALID_ID, kInvalidWebstoreItemId);
60 return; 61 return;
61 } 62 }
62 63
63 webstore_install::Result result = webstore_install::OTHER_ERROR; 64 webstore_install::Result result = webstore_install::OTHER_ERROR;
64 std::string error; 65 std::string error;
65 if (!EnsureUniqueInstall(&result, &error)) { 66 if (!EnsureUniqueInstall(&result, &error)) {
66 CompleteInstall(result, error); 67 CompleteInstall(result, error);
67 return; 68 return;
68 } 69 }
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 void WebstoreStandaloneInstaller::OnWebStoreDataFetcherDone() { 435 void WebstoreStandaloneInstaller::OnWebStoreDataFetcherDone() {
435 // An instance of this class is passed in as a delegate for the 436 // An instance of this class is passed in as a delegate for the
436 // WebstoreInstallHelper, ExtensionInstallPrompt and WebstoreInstaller, and 437 // WebstoreInstallHelper, ExtensionInstallPrompt and WebstoreInstaller, and
437 // therefore needs to remain alive until they are done. Clear the webstore 438 // therefore needs to remain alive until they are done. Clear the webstore
438 // data fetcher to avoid calling Release in AbortInstall while any of these 439 // data fetcher to avoid calling Release in AbortInstall while any of these
439 // operations are in progress. 440 // operations are in progress.
440 webstore_data_fetcher_.reset(); 441 webstore_data_fetcher_.reset();
441 } 442 }
442 443
443 } // namespace extensions 444 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698