Chromium Code Reviews| 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/menu_manager.h" | 5 #include "chrome/browser/extensions/menu_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 return false; | 256 return false; |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 if (properties.HasKey(target_url_patterns_key)) { | 259 if (properties.HasKey(target_url_patterns_key)) { |
| 260 const ListValue* list = NULL; | 260 const ListValue* list = NULL; |
| 261 if (!properties.GetList(target_url_patterns_key, &list)) | 261 if (!properties.GetList(target_url_patterns_key, &list)) |
| 262 return false; | 262 return false; |
| 263 if (!target_url_patterns_.Populate( | 263 if (!target_url_patterns_.Populate( |
| 264 *list, URLPattern::SCHEME_ALL, true, error)) { | 264 *list, URLPattern::SCHEME_ALL, true, error)) { |
| 265 return false; | 265 return false; |
| 266 } | 266 } |
|
not at google - send to devlin
2012/08/06 01:55:45
plz just convert these to vectors and pass in Popu
chebert
2012/08/06 03:38:04
Umm. Sorry I think I patched from the wrong branch
not at google - send to devlin
2012/08/06 03:58:42
No probs :)
| |
| 267 } | 267 } |
| 268 return true; | 268 return true; |
| 269 } | 269 } |
| 270 | 270 |
| 271 bool MenuItem::PopulateURLPatterns( | |
| 272 std::vector<std::string>* document_url_patterns, | |
| 273 std::vector<std::string>* target_url_patterns, | |
| 274 std::string* error) { | |
| 275 if (document_url_patterns) { | |
| 276 if (!document_url_patterns_.Populate( | |
| 277 *document_url_patterns, URLPattern::SCHEME_ALL, true, error)) { | |
| 278 return false; | |
| 279 } | |
| 280 } | |
| 281 if (target_url_patterns) { | |
| 282 if (!target_url_patterns_.Populate( | |
| 283 *target_url_patterns, URLPattern::SCHEME_ALL, true, error)) { | |
| 284 return false; | |
| 285 } | |
| 286 } | |
| 287 return true; | |
| 288 } | |
| 289 | |
| 271 MenuManager::MenuManager(Profile* profile) | 290 MenuManager::MenuManager(Profile* profile) |
| 272 : profile_(profile) { | 291 : profile_(profile) { |
| 273 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 292 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
| 274 content::Source<Profile>(profile)); | 293 content::Source<Profile>(profile)); |
| 275 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 294 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| 276 content::Source<Profile>(profile)); | 295 content::Source<Profile>(profile)); |
| 277 | 296 |
| 278 StateStore* store = ExtensionSystem::Get(profile_)->state_store(); | 297 StateStore* store = ExtensionSystem::Get(profile_)->state_store(); |
| 279 if (store) | 298 if (store) |
| 280 store->RegisterKey(kContextMenusKey); | 299 store->RegisterKey(kContextMenusKey); |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 817 if (uid < other.uid) | 836 if (uid < other.uid) |
| 818 return true; | 837 return true; |
| 819 if (uid == other.uid) | 838 if (uid == other.uid) |
| 820 return string_uid < other.string_uid; | 839 return string_uid < other.string_uid; |
| 821 } | 840 } |
| 822 } | 841 } |
| 823 return false; | 842 return false; |
| 824 } | 843 } |
| 825 | 844 |
| 826 } // namespace extensions | 845 } // namespace extensions |
| OLD | NEW |