| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/extensions/activity_log/activity_actions.h" | 5 #include "chrome/browser/extensions/activity_log/activity_actions.h" |
| 6 | 6 |
| 7 #include <algorithm> // for std::find. | 7 #include <algorithm> // for std::find. |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 other_.reset(new base::DictionaryValue()); | 184 other_.reset(new base::DictionaryValue()); |
| 185 } | 185 } |
| 186 return other_.get(); | 186 return other_.get(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 std::string Action::SerializePageUrl() const { | 189 std::string Action::SerializePageUrl() const { |
| 190 return (page_incognito() ? constants::kIncognitoUrl : "") + page_url().spec(); | 190 return (page_incognito() ? constants::kIncognitoUrl : "") + page_url().spec(); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void Action::ParsePageUrl(const std::string& url) { | 193 void Action::ParsePageUrl(const std::string& url) { |
| 194 set_page_incognito(StartsWithASCII(url, constants::kIncognitoUrl, true)); | 194 set_page_incognito( |
| 195 base::StartsWithASCII(url, constants::kIncognitoUrl, true)); |
| 195 if (page_incognito()) | 196 if (page_incognito()) |
| 196 set_page_url(GURL(url.substr(strlen(constants::kIncognitoUrl)))); | 197 set_page_url(GURL(url.substr(strlen(constants::kIncognitoUrl)))); |
| 197 else | 198 else |
| 198 set_page_url(GURL(url)); | 199 set_page_url(GURL(url)); |
| 199 } | 200 } |
| 200 | 201 |
| 201 std::string Action::SerializeArgUrl() const { | 202 std::string Action::SerializeArgUrl() const { |
| 202 return (arg_incognito() ? constants::kIncognitoUrl : "") + arg_url().spec(); | 203 return (arg_incognito() ? constants::kIncognitoUrl : "") + arg_url().spec(); |
| 203 } | 204 } |
| 204 | 205 |
| 205 void Action::ParseArgUrl(const std::string& url) { | 206 void Action::ParseArgUrl(const std::string& url) { |
| 206 set_arg_incognito(StartsWithASCII(url, constants::kIncognitoUrl, true)); | 207 set_arg_incognito(base::StartsWithASCII(url, constants::kIncognitoUrl, true)); |
| 207 if (arg_incognito()) | 208 if (arg_incognito()) |
| 208 set_arg_url(GURL(url.substr(strlen(constants::kIncognitoUrl)))); | 209 set_arg_url(GURL(url.substr(strlen(constants::kIncognitoUrl)))); |
| 209 else | 210 else |
| 210 set_arg_url(GURL(url)); | 211 set_arg_url(GURL(url)); |
| 211 } | 212 } |
| 212 | 213 |
| 213 scoped_ptr<ExtensionActivity> Action::ConvertToExtensionActivity() { | 214 scoped_ptr<ExtensionActivity> Action::ConvertToExtensionActivity() { |
| 214 scoped_ptr<ExtensionActivity> result(new ExtensionActivity); | 215 scoped_ptr<ExtensionActivity> result(new ExtensionActivity); |
| 215 | 216 |
| 216 // We do this translation instead of using the same enum because the database | 217 // We do this translation instead of using the same enum because the database |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 std::string rhs_other = ActivityLogPolicy::Util::Serialize(rhs->other()); | 554 std::string rhs_other = ActivityLogPolicy::Util::Serialize(rhs->other()); |
| 554 if (lhs_other != rhs_other) | 555 if (lhs_other != rhs_other) |
| 555 return lhs_other < rhs_other; | 556 return lhs_other < rhs_other; |
| 556 } | 557 } |
| 557 | 558 |
| 558 // All fields compare as equal if this point is reached. | 559 // All fields compare as equal if this point is reached. |
| 559 return false; | 560 return false; |
| 560 } | 561 } |
| 561 | 562 |
| 562 } // namespace extensions | 563 } // namespace extensions |
| OLD | NEW |