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

Side by Side Diff: extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 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
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 "extensions/browser/api/declarative_webrequest/webrequest_condition_att ribute.h" 5 #include "extensions/browser/api/declarative_webrequest/webrequest_condition_att ribute.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 match_type = StringMatchTest::kEquals; 500 match_type = StringMatchTest::kEquals;
501 } else { 501 } else {
502 NOTREACHED(); // JSON schema type checking should prevent this. 502 NOTREACHED(); // JSON schema type checking should prevent this.
503 return std::unique_ptr<const HeaderMatchTest>(); 503 return std::unique_ptr<const HeaderMatchTest>();
504 } 504 }
505 const base::Value* content = &it.value(); 505 const base::Value* content = &it.value();
506 506
507 std::vector<std::unique_ptr<const StringMatchTest>>* tests = 507 std::vector<std::unique_ptr<const StringMatchTest>>* tests =
508 is_name ? &name_match : &value_match; 508 is_name ? &name_match : &value_match;
509 switch (content->GetType()) { 509 switch (content->GetType()) {
510 case base::Value::TYPE_LIST: { 510 case base::Value::Type::LIST: {
511 const base::ListValue* list = NULL; 511 const base::ListValue* list = NULL;
512 CHECK(content->GetAsList(&list)); 512 CHECK(content->GetAsList(&list));
513 for (const auto& it : *list) { 513 for (const auto& it : *list) {
514 tests->push_back(StringMatchTest::Create(*it, match_type, !is_name)); 514 tests->push_back(StringMatchTest::Create(*it, match_type, !is_name));
515 } 515 }
516 break; 516 break;
517 } 517 }
518 case base::Value::TYPE_STRING: { 518 case base::Value::Type::STRING: {
519 tests->push_back( 519 tests->push_back(
520 StringMatchTest::Create(*content, match_type, !is_name)); 520 StringMatchTest::Create(*content, match_type, !is_name));
521 break; 521 break;
522 } 522 }
523 default: { 523 default: {
524 NOTREACHED(); // JSON schema type checking should prevent this. 524 NOTREACHED(); // JSON schema type checking should prevent this.
525 return std::unique_ptr<const HeaderMatchTest>(); 525 return std::unique_ptr<const HeaderMatchTest>();
526 } 526 }
527 } 527 }
528 } 528 }
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 bool WebRequestConditionAttributeStages::Equals( 875 bool WebRequestConditionAttributeStages::Equals(
876 const WebRequestConditionAttribute* other) const { 876 const WebRequestConditionAttribute* other) const {
877 if (!WebRequestConditionAttribute::Equals(other)) 877 if (!WebRequestConditionAttribute::Equals(other))
878 return false; 878 return false;
879 const WebRequestConditionAttributeStages* casted_other = 879 const WebRequestConditionAttributeStages* casted_other =
880 static_cast<const WebRequestConditionAttributeStages*>(other); 880 static_cast<const WebRequestConditionAttributeStages*>(other);
881 return allowed_stages_ == casted_other->allowed_stages_; 881 return allowed_stages_ == casted_other->allowed_stages_;
882 } 882 }
883 883
884 } // namespace extensions 884 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698