OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_MODEL_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_MODEL_H_ |
6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_MODEL_H_ | 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_MODEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 363 |
364 // Removes the keyword from the model. This deletes the supplied TemplateURL. | 364 // Removes the keyword from the model. This deletes the supplied TemplateURL. |
365 // This fails if the supplied template_url is the default search provider. | 365 // This fails if the supplied template_url is the default search provider. |
366 // Caller is responsible for notifying observers. | 366 // Caller is responsible for notifying observers. |
367 void RemoveNoNotify(const TemplateURL* template_url); | 367 void RemoveNoNotify(const TemplateURL* template_url); |
368 | 368 |
369 // Notify the observers that the model has changed. This is done only if the | 369 // Notify the observers that the model has changed. This is done only if the |
370 // model is loaded. | 370 // model is loaded. |
371 void NotifyObservers(); | 371 void NotifyObservers(); |
372 | 372 |
| 373 // Removes from the vector any template URL that was created because of |
| 374 // policy. These TemplateURLs are freed and removed from the database. |
| 375 // Sets default_search_provider to NULL if it was one of them, unless it is |
| 376 // the same as the current default from preferences and it is managed. |
| 377 void RemoveProvidersCreatedByPolicy( |
| 378 std::vector<TemplateURL*>* template_urls, |
| 379 const TemplateURL** default_search_provider, |
| 380 const TemplateURL* default_from_prefs); |
| 381 |
373 NotificationRegistrar registrar_; | 382 NotificationRegistrar registrar_; |
374 | 383 |
375 // Mapping from keyword to the TemplateURL. | 384 // Mapping from keyword to the TemplateURL. |
376 KeywordToTemplateMap keyword_to_template_map_; | 385 KeywordToTemplateMap keyword_to_template_map_; |
377 | 386 |
378 TemplateURLVector template_urls_; | 387 TemplateURLVector template_urls_; |
379 | 388 |
380 ObserverList<TemplateURLModelObserver> model_observers_; | 389 ObserverList<TemplateURLModelObserver> model_observers_; |
381 | 390 |
382 // Maps from host to set of TemplateURLs whose search url host is host. | 391 // Maps from host to set of TemplateURLs whose search url host is host. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 // increasing integer that is initialized from the database. | 435 // increasing integer that is initialized from the database. |
427 TemplateURLID next_id_; | 436 TemplateURLID next_id_; |
428 | 437 |
429 // List of extension IDs waiting for Load to have keywords registered. | 438 // List of extension IDs waiting for Load to have keywords registered. |
430 std::vector<std::string> pending_extension_ids_; | 439 std::vector<std::string> pending_extension_ids_; |
431 | 440 |
432 DISALLOW_COPY_AND_ASSIGN(TemplateURLModel); | 441 DISALLOW_COPY_AND_ASSIGN(TemplateURLModel); |
433 }; | 442 }; |
434 | 443 |
435 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_MODEL_H_ | 444 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_MODEL_H_ |
OLD | NEW |