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

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

Issue 1301883002: Revert of base: Remove using:: declaration from version.h header. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 12 matching lines...) Expand all
23 // default one is assumed. 23 // default one is assumed.
24 // TODO(skerner): Make this class an implementation detail of 24 // TODO(skerner): Make this class an implementation detail of
25 // PendingExtensionManager, and remove all other users. 25 // PendingExtensionManager, and remove all other users.
26 class PendingExtensionInfo { 26 class PendingExtensionInfo {
27 public: 27 public:
28 typedef bool (*ShouldAllowInstallPredicate)(const Extension*); 28 typedef bool (*ShouldAllowInstallPredicate)(const Extension*);
29 29
30 PendingExtensionInfo(const std::string& id, 30 PendingExtensionInfo(const std::string& id,
31 const std::string& install_parameter, 31 const std::string& install_parameter,
32 const GURL& update_url, 32 const GURL& update_url,
33 const base::Version& version, 33 const Version& version,
34 ShouldAllowInstallPredicate should_allow_install, 34 ShouldAllowInstallPredicate should_allow_install,
35 bool is_from_sync, 35 bool is_from_sync,
36 Manifest::Location install_source, 36 Manifest::Location install_source,
37 int creation_flags, 37 int creation_flags,
38 bool mark_acknowledged, 38 bool mark_acknowledged,
39 bool remote_install); 39 bool remote_install);
40 40
41 // Required for STL container membership. Should not be used directly. 41 // Required for STL container membership. Should not be used directly.
42 PendingExtensionInfo(); 42 PendingExtensionInfo();
43 43
44 ~PendingExtensionInfo(); 44 ~PendingExtensionInfo();
45 45
46 // Consider two PendingExtensionInfos equal if their ids are equal. 46 // Consider two PendingExtensionInfos equal if their ids are equal.
47 bool operator==(const PendingExtensionInfo& rhs) const; 47 bool operator==(const PendingExtensionInfo& rhs) const;
48 48
49 const std::string& id() const { return id_; } 49 const std::string& id() const { return id_; }
50 const GURL& update_url() const { return update_url_; } 50 const GURL& update_url() const { return update_url_; }
51 const base::Version& version() const { return version_; } 51 const Version& version() const { return version_; }
52 const std::string& install_parameter() const { return install_parameter_; } 52 const std::string& install_parameter() const { return install_parameter_; }
53 53
54 // ShouldAllowInstall() returns the result of running constructor argument 54 // ShouldAllowInstall() returns the result of running constructor argument
55 // |should_allow_install| on an extension. After an extension is unpacked, 55 // |should_allow_install| on an extension. After an extension is unpacked,
56 // this function is run. If it returns true, the extension is installed. 56 // this function is run. If it returns true, the extension is installed.
57 // If not, the extension is discarded. This allows creators of 57 // If not, the extension is discarded. This allows creators of
58 // PendingExtensionInfo objects to ensure that extensions meet some criteria 58 // PendingExtensionInfo objects to ensure that extensions meet some criteria
59 // that can only be tested once the extension is unpacked. 59 // that can only be tested once the extension is unpacked.
60 bool ShouldAllowInstall(const Extension* extension) const { 60 bool ShouldAllowInstall(const Extension* extension) const {
61 return should_allow_install_(extension); 61 return should_allow_install_(extension);
62 } 62 }
63 bool is_from_sync() const { return is_from_sync_; } 63 bool is_from_sync() const { return is_from_sync_; }
64 Manifest::Location install_source() const { return install_source_; } 64 Manifest::Location install_source() const { return install_source_; }
65 int creation_flags() const { return creation_flags_; } 65 int creation_flags() const { return creation_flags_; }
66 bool mark_acknowledged() const { return mark_acknowledged_; } 66 bool mark_acknowledged() const { return mark_acknowledged_; }
67 bool remote_install() const { return remote_install_; } 67 bool remote_install() const { return remote_install_; }
68 68
69 // Returns -1, 0 or 1 if |this| has lower, equal or higher precedence than 69 // Returns -1, 0 or 1 if |this| has lower, equal or higher precedence than
70 // |other|, respectively. "Equal" precedence means that the version and the 70 // |other|, respectively. "Equal" precedence means that the version and the
71 // install source match. "Higher" precedence means that the version is newer, 71 // install source match. "Higher" precedence means that the version is newer,
72 // or the version matches but the install source has higher priority. 72 // or the version matches but the install source has higher priority.
73 // It is only valid to invoke this when the ids match. 73 // It is only valid to invoke this when the ids match.
74 int CompareTo(const PendingExtensionInfo& other) const; 74 int CompareTo(const PendingExtensionInfo& other) const;
75 75
76 private: 76 private:
77 std::string id_; 77 std::string id_;
78 78
79 GURL update_url_; 79 GURL update_url_;
80 base::Version version_; 80 Version version_;
81 std::string install_parameter_; 81 std::string install_parameter_;
82 82
83 // When the extension is about to be installed, this function is 83 // When the extension is about to be installed, this function is
84 // called. If this function returns true, the install proceeds. If 84 // called. If this function returns true, the install proceeds. If
85 // this function returns false, the install is aborted. 85 // this function returns false, the install is aborted.
86 ShouldAllowInstallPredicate should_allow_install_; 86 ShouldAllowInstallPredicate should_allow_install_;
87 87
88 bool is_from_sync_; // This update check was initiated from sync. 88 bool is_from_sync_; // This update check was initiated from sync.
89 Manifest::Location install_source_; 89 Manifest::Location install_source_;
90 int creation_flags_; 90 int creation_flags_;
91 bool mark_acknowledged_; 91 bool mark_acknowledged_;
92 bool remote_install_; 92 bool remote_install_;
93 93
94 FRIEND_TEST_ALL_PREFIXES(::ExtensionServiceTest, AddPendingExtensionFromSync); 94 FRIEND_TEST_ALL_PREFIXES(::ExtensionServiceTest, AddPendingExtensionFromSync);
95 }; 95 };
96 96
97 } // namespace extensions 97 } // namespace extensions
98 98
99 #endif // CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_ 99 #endif // CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/external_registry_loader_win.cc ('k') | chrome/browser/extensions/pending_extension_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698