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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_api_helpers.cc

Issue 10071035: RefCounted types should not have public destructors, chrome/browser/extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fix 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 | 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/api/web_request/web_request_api_helpers.h" 5 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/extensions/api/web_request/web_request_api.h" 10 #include "chrome/browser/extensions/api/web_request/web_request_api.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 EventLogEntry::~EventLogEntry() { 72 EventLogEntry::~EventLogEntry() {
73 } 73 }
74 74
75 75
76 // NetLog parameter to indicate the ID of the extension that caused an event. 76 // NetLog parameter to indicate the ID of the extension that caused an event.
77 class NetLogExtensionIdParameter : public net::NetLog::EventParameters { 77 class NetLogExtensionIdParameter : public net::NetLog::EventParameters {
78 public: 78 public:
79 explicit NetLogExtensionIdParameter(const std::string& extension_id) 79 explicit NetLogExtensionIdParameter(const std::string& extension_id)
80 : extension_id_(extension_id) {} 80 : extension_id_(extension_id) {}
81 virtual ~NetLogExtensionIdParameter() {}
82 81
83 virtual base::Value* ToValue() const OVERRIDE { 82 virtual base::Value* ToValue() const OVERRIDE {
84 DictionaryValue* dict = new DictionaryValue(); 83 DictionaryValue* dict = new DictionaryValue();
85 dict->SetString("extension_id", extension_id_); 84 dict->SetString("extension_id", extension_id_);
86 return dict; 85 return dict;
87 } 86 }
88 87
88 protected:
89 virtual ~NetLogExtensionIdParameter() {}
90
89 private: 91 private:
90 const std::string extension_id_; 92 const std::string extension_id_;
91 93
92 DISALLOW_COPY_AND_ASSIGN(NetLogExtensionIdParameter); 94 DISALLOW_COPY_AND_ASSIGN(NetLogExtensionIdParameter);
93 }; 95 };
94 96
95 97
96 // NetLog parameter to indicate that an extension modified a request. 98 // NetLog parameter to indicate that an extension modified a request.
97 class NetLogModificationParameter : public NetLogExtensionIdParameter { 99 class NetLogModificationParameter : public NetLogExtensionIdParameter {
98 public: 100 public:
99 explicit NetLogModificationParameter(const std::string& extension_id) 101 explicit NetLogModificationParameter(const std::string& extension_id)
100 : NetLogExtensionIdParameter(extension_id) {} 102 : NetLogExtensionIdParameter(extension_id) {}
101 virtual ~NetLogModificationParameter() {}
102 103
103 virtual base::Value* ToValue() const OVERRIDE { 104 virtual base::Value* ToValue() const OVERRIDE {
104 Value* parent = NetLogExtensionIdParameter::ToValue(); 105 Value* parent = NetLogExtensionIdParameter::ToValue();
105 DCHECK(parent->IsType(Value::TYPE_DICTIONARY)); 106 DCHECK(parent->IsType(Value::TYPE_DICTIONARY));
106 DictionaryValue* dict = static_cast<DictionaryValue*>(parent); 107 DictionaryValue* dict = static_cast<DictionaryValue*>(parent);
107 dict->Set("modified_headers", modified_headers_.DeepCopy()); 108 dict->Set("modified_headers", modified_headers_.DeepCopy());
108 dict->Set("deleted_headers", deleted_headers_.DeepCopy()); 109 dict->Set("deleted_headers", deleted_headers_.DeepCopy());
109 return dict; 110 return dict;
110 } 111 }
111 112
112 void DeletedHeader(const std::string& key) { 113 void DeletedHeader(const std::string& key) {
113 deleted_headers_.Append(Value::CreateStringValue(key)); 114 deleted_headers_.Append(Value::CreateStringValue(key));
114 } 115 }
115 116
116 void ModifiedHeader(const std::string& key, const std::string& value) { 117 void ModifiedHeader(const std::string& key, const std::string& value) {
117 modified_headers_.Append(Value::CreateStringValue(key + ": " + value)); 118 modified_headers_.Append(Value::CreateStringValue(key + ": " + value));
118 } 119 }
119 120
120 private: 121 private:
122 virtual ~NetLogModificationParameter() {}
123
121 ListValue modified_headers_; 124 ListValue modified_headers_;
122 ListValue deleted_headers_; 125 ListValue deleted_headers_;
123 126
124 DISALLOW_COPY_AND_ASSIGN(NetLogModificationParameter); 127 DISALLOW_COPY_AND_ASSIGN(NetLogModificationParameter);
125 }; 128 };
126 129
127 130
128 bool InDecreasingExtensionInstallationTimeOrder( 131 bool InDecreasingExtensionInstallationTimeOrder(
129 const linked_ptr<EventResponseDelta>& a, 132 const linked_ptr<EventResponseDelta>& a,
130 const linked_ptr<EventResponseDelta>& b) { 133 const linked_ptr<EventResponseDelta>& b) {
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 ResourceType::Type* type) { 656 ResourceType::Type* type) {
654 const char** iter = 657 const char** iter =
655 std::find(kResourceTypeStrings, ARRAYEND(kResourceTypeStrings), type_str); 658 std::find(kResourceTypeStrings, ARRAYEND(kResourceTypeStrings), type_str);
656 if (iter == ARRAYEND(kResourceTypeStrings)) 659 if (iter == ARRAYEND(kResourceTypeStrings))
657 return false; 660 return false;
658 *type = kResourceTypeValues[iter - kResourceTypeStrings]; 661 *type = kResourceTypeValues[iter - kResourceTypeStrings];
659 return true; 662 return true;
660 } 663 }
661 664
662 } // namespace extension_web_request_api_helpers 665 } // namespace extension_web_request_api_helpers
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/web_request/web_request_api.cc ('k') | chrome/browser/extensions/app_notification_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698