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

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

Issue 100543005: Update all users of base::Version to explicitly specify the namespace, and clean up the header. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: someday it will work Created 7 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 EXTENSIONS_BROWSER_PENDING_EXTENSION_INFO_H_ 5 #ifndef EXTENSIONS_BROWSER_PENDING_EXTENSION_INFO_H_
6 #define EXTENSIONS_BROWSER_PENDING_EXTENSION_INFO_H_ 6 #define EXTENSIONS_BROWSER_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( 30 PendingExtensionInfo(
31 const std::string& id, 31 const std::string& id,
32 const GURL& update_url, 32 const GURL& update_url,
33 const Version& version, 33 const base::Version& version,
34 ShouldAllowInstallPredicate should_allow_install, 34 ShouldAllowInstallPredicate should_allow_install,
35 bool is_from_sync, 35 bool is_from_sync,
36 bool install_silently, 36 bool install_silently,
37 Manifest::Location install_source, 37 Manifest::Location install_source,
38 int creation_flags, 38 int creation_flags,
39 bool mark_acknowledged); 39 bool mark_acknowledged);
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 // Consider two PendingExtensionInfos equal if their ids are equal. 44 // Consider two PendingExtensionInfos equal if their ids are equal.
45 bool operator==(const PendingExtensionInfo& rhs) const; 45 bool operator==(const PendingExtensionInfo& rhs) const;
46 46
47 const std::string& id() const { return id_; } 47 const std::string& id() const { return id_; }
48 const GURL& update_url() const { return update_url_; } 48 const GURL& update_url() const { return update_url_; }
49 const Version& version() const { return version_; } 49 const base::Version& version() const { return version_; }
50 50
51 // ShouldAllowInstall() returns the result of running constructor argument 51 // ShouldAllowInstall() returns the result of running constructor argument
52 // |should_allow_install| on an extension. After an extension is unpacked, 52 // |should_allow_install| on an extension. After an extension is unpacked,
53 // this function is run. If it returns true, the extension is installed. 53 // this function is run. If it returns true, the extension is installed.
54 // If not, the extension is discarded. This allows creators of 54 // If not, the extension is discarded. This allows creators of
55 // PendingExtensionInfo objects to ensure that extensions meet some criteria 55 // PendingExtensionInfo objects to ensure that extensions meet some criteria
56 // that can only be tested once the extension is unpacked. 56 // that can only be tested once the extension is unpacked.
57 bool ShouldAllowInstall(const Extension* extension) const { 57 bool ShouldAllowInstall(const Extension* extension) const {
58 return should_allow_install_(extension); 58 return should_allow_install_(extension);
59 } 59 }
60 bool is_from_sync() const { return is_from_sync_; } 60 bool is_from_sync() const { return is_from_sync_; }
61 bool install_silently() const { return install_silently_; } 61 bool install_silently() const { return install_silently_; }
62 Manifest::Location install_source() const { return install_source_; } 62 Manifest::Location install_source() const { return install_source_; }
63 int creation_flags() const { return creation_flags_; } 63 int creation_flags() const { return creation_flags_; }
64 bool mark_acknowledged() const { return mark_acknowledged_; } 64 bool mark_acknowledged() const { return mark_acknowledged_; }
65 65
66 // Returns -1, 0 or 1 if |this| has lower, equal or higher precedence than 66 // Returns -1, 0 or 1 if |this| has lower, equal or higher precedence than
67 // |other|, respectively. "Equal" precedence means that the version and the 67 // |other|, respectively. "Equal" precedence means that the version and the
68 // install source match. "Higher" precedence means that the version is newer, 68 // install source match. "Higher" precedence means that the version is newer,
69 // or the version matches but the install source has higher priority. 69 // or the version matches but the install source has higher priority.
70 // It is only valid to invoke this when the ids match. 70 // It is only valid to invoke this when the ids match.
71 int CompareTo(const PendingExtensionInfo& other) const; 71 int CompareTo(const PendingExtensionInfo& other) const;
72 72
73 private: 73 private:
74 std::string id_; 74 std::string id_;
75 75
76 GURL update_url_; 76 GURL update_url_;
77 Version version_; 77 base::Version version_;
78 78
79 // When the extension is about to be installed, this function is 79 // When the extension is about to be installed, this function is
80 // called. If this function returns true, the install proceeds. If 80 // called. If this function returns true, the install proceeds. If
81 // this function returns false, the install is aborted. 81 // this function returns false, the install is aborted.
82 ShouldAllowInstallPredicate should_allow_install_; 82 ShouldAllowInstallPredicate should_allow_install_;
83 83
84 bool is_from_sync_; // This update check was initiated from sync. 84 bool is_from_sync_; // This update check was initiated from sync.
85 bool install_silently_; 85 bool install_silently_;
86 Manifest::Location install_source_; 86 Manifest::Location install_source_;
87 int creation_flags_; 87 int creation_flags_;
88 bool mark_acknowledged_; 88 bool mark_acknowledged_;
89 89
90 FRIEND_TEST_ALL_PREFIXES(::ExtensionServiceTest, AddPendingExtensionFromSync); 90 FRIEND_TEST_ALL_PREFIXES(::ExtensionServiceTest, AddPendingExtensionFromSync);
91 }; 91 };
92 92
93 } // namespace extensions 93 } // namespace extensions
94 94
95 #endif // EXTENSIONS_BROWSER_PENDING_EXTENSION_INFO_H_ 95 #endif // EXTENSIONS_BROWSER_PENDING_EXTENSION_INFO_H_
OLDNEW
« no previous file with comments | « content/renderer/npapi/webplugin_delegate_proxy.cc ('k') | extensions/browser/pending_extension_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698