| OLD | NEW | 
|---|
| 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/declarative_content/content_condition.h" | 5 #include "chrome/browser/extensions/api/declarative_content/content_condition.h" | 
| 6 | 6 | 
| 7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" | 
| 8 #include "base/values.h" | 8 #include "base/values.h" | 
| 9 #include "chrome/browser/extensions/api/declarative_content/content_constants.h" | 9 #include "chrome/browser/extensions/api/declarative_content/content_constants.h" | 
| 10 #include "extensions/common/matcher/url_matcher_factory.h" | 10 #include "extensions/common/matcher/url_matcher_factory.h" | 
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 119                                     condition_attribute_name.c_str()); | 119                                     condition_attribute_name.c_str()); | 
| 120       } | 120       } | 
| 121     } else { | 121     } else { | 
| 122       *error = base::StringPrintf(kUnknownConditionAttribute, | 122       *error = base::StringPrintf(kUnknownConditionAttribute, | 
| 123                                   condition_attribute_name.c_str()); | 123                                   condition_attribute_name.c_str()); | 
| 124     } | 124     } | 
| 125     if (!error->empty()) | 125     if (!error->empty()) | 
| 126       return scoped_ptr<ContentCondition>(NULL); | 126       return scoped_ptr<ContentCondition>(NULL); | 
| 127   } | 127   } | 
| 128 | 128 | 
| 129   if (!url_matcher_condition_set) { | 129   if (!url_matcher_condition_set.get()) { | 
| 130     URLMatcherConditionSet::Conditions url_matcher_conditions; | 130     URLMatcherConditionSet::Conditions url_matcher_conditions; | 
| 131     url_matcher_conditions.insert( | 131     url_matcher_conditions.insert( | 
| 132         url_matcher_condition_factory->CreateHostPrefixCondition( | 132         url_matcher_condition_factory->CreateHostPrefixCondition( | 
| 133             std::string())); | 133             std::string())); | 
| 134     url_matcher_condition_set = | 134     url_matcher_condition_set = | 
| 135         new URLMatcherConditionSet(++g_next_id, url_matcher_conditions); | 135         new URLMatcherConditionSet(++g_next_id, url_matcher_conditions); | 
| 136   } | 136   } | 
| 137   return scoped_ptr<ContentCondition>( | 137   return scoped_ptr<ContentCondition>( | 
| 138       new ContentCondition(url_matcher_condition_set, css_rules)); | 138       new ContentCondition(url_matcher_condition_set, css_rules)); | 
| 139 } | 139 } | 
| 140 | 140 | 
| 141 }  // namespace extensions | 141 }  // namespace extensions | 
| OLD | NEW | 
|---|