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

Side by Side Diff: chrome/browser/extensions/pending_extension_info.h

Issue 9595001: Apps on NTP should be in order of installation (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: More fixes Created 8 years, 8 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_
6 #define CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_ 6 #define CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/common/extensions/extension.h" 9 #include "chrome/common/extensions/extension.h"
10 10
11 class GURL; 11 class GURL;
12 12
13 // A pending extension is an extension that hasn't been installed yet 13 // A pending extension is an extension that hasn't been installed yet
14 // and is intended to be installed in the next auto-update cycle. The 14 // and is intended to be installed in the next auto-update cycle. The
15 // update URL of a pending extension may be blank, in which case a 15 // update URL of a pending extension may be blank, in which case a
16 // default one is assumed. 16 // default one is assumed.
17 // TODO(skerner): Make this class an implementation detail of 17 // TODO(skerner): Make this class an implementation detail of
18 // PendingExtensionManager, and remove all other users. 18 // PendingExtensionManager, and remove all other users.
19 class PendingExtensionInfo { 19 class PendingExtensionInfo {
20 public: 20 public:
21 typedef bool (*ShouldAllowInstallPredicate)(const Extension&); 21 typedef bool (*ShouldAllowInstallPredicate)(const Extension&);
22 22
23 PendingExtensionInfo( 23 PendingExtensionInfo(
24 const std::string& id,
24 const GURL& update_url, 25 const GURL& update_url,
25 ShouldAllowInstallPredicate should_allow_install, 26 ShouldAllowInstallPredicate should_allow_install,
26 bool is_from_sync, 27 bool is_from_sync,
27 bool install_silently, 28 bool install_silently,
28 Extension::Location install_source); 29 Extension::Location install_source);
29 30
30 // Required for STL container membership. Should not be used directly. 31 // Required for STL container membership. Should not be used directly.
31 PendingExtensionInfo(); 32 PendingExtensionInfo();
32 33
34 const std::string& id() const { return id_; }
33 const GURL& update_url() const { return update_url_; } 35 const GURL& update_url() const { return update_url_; }
34 36
35 // ShouldAllowInstall() returns the result of running constructor argument 37 // ShouldAllowInstall() returns the result of running constructor argument
36 // |should_allow_install| on an extension. After an extension is unpacked, 38 // |should_allow_install| on an extension. After an extension is unpacked,
37 // this function is run. If it returns true, the extension is installed. 39 // this function is run. If it returns true, the extension is installed.
38 // If not, the extension is discarded. This allows creators of 40 // If not, the extension is discarded. This allows creators of
39 // PendingExtensionInfo objects to ensure that extensions meet some criteria 41 // PendingExtensionInfo objects to ensure that extensions meet some criteria
40 // that can only be tested once the extension is unpacked. 42 // that can only be tested once the extension is unpacked.
41 bool ShouldAllowInstall(const Extension& extension) const { 43 bool ShouldAllowInstall(const Extension& extension) const {
42 return should_allow_install_(extension); 44 return should_allow_install_(extension);
43 } 45 }
44 bool is_from_sync() const { return is_from_sync_; } 46 bool is_from_sync() const { return is_from_sync_; }
45 bool install_silently() const { return install_silently_; } 47 bool install_silently() const { return install_silently_; }
46 Extension::Location install_source() const { return install_source_; } 48 Extension::Location install_source() const { return install_source_; }
47 49
48 private: 50 private:
51 const std::string& id_;
Aaron Boodman 2012/05/01 15:50:22 No need for this to be const since it is private.
mitchellwrosen 2012/05/11 05:45:03 Compiler barks about initializing a non-const std:
Aaron Boodman 2012/05/11 19:23:55 It should work if its non-reference. Just plain ol
52
49 GURL update_url_; 53 GURL update_url_;
50 54
51 // When the extension is about to be installed, this function is 55 // When the extension is about to be installed, this function is
52 // called. If this function returns true, the install proceeds. If 56 // called. If this function returns true, the install proceeds. If
53 // this function returns false, the install is aborted. 57 // this function returns false, the install is aborted.
54 ShouldAllowInstallPredicate should_allow_install_; 58 ShouldAllowInstallPredicate should_allow_install_;
55 59
56 bool is_from_sync_; // This update check was initiated from sync. 60 bool is_from_sync_; // This update check was initiated from sync.
57 bool install_silently_; 61 bool install_silently_;
58 Extension::Location install_source_; 62 Extension::Location install_source_;
59 63
60 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, AddPendingExtensionFromSync); 64 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, AddPendingExtensionFromSync);
61 }; 65 };
62 66
63 #endif // CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_ 67 #endif // CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698