OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // . NOTIFY_HISTORY_URL_VISITED: adds keyword search terms if the visit | 212 // . NOTIFY_HISTORY_URL_VISITED: adds keyword search terms if the visit |
213 // corresponds to a keyword. | 213 // corresponds to a keyword. |
214 // . NOTIFY_GOOGLE_URL_UPDATED: updates mapping for any keywords containing | 214 // . NOTIFY_GOOGLE_URL_UPDATED: updates mapping for any keywords containing |
215 // a google base url replacement term. | 215 // a google base url replacement term. |
216 virtual void Observe(NotificationType type, | 216 virtual void Observe(NotificationType type, |
217 const NotificationSource& source, | 217 const NotificationSource& source, |
218 const NotificationDetails& details); | 218 const NotificationDetails& details); |
219 | 219 |
220 Profile* profile() const { return profile_; } | 220 Profile* profile() const { return profile_; } |
221 | 221 |
| 222 void SetSearchEngineDialogSlot(int slot) { |
| 223 search_engine_dialog_chosen_slot_ = slot; |
| 224 } |
| 225 |
| 226 int GetSearchEngineDialogSlot() const { |
| 227 return search_engine_dialog_chosen_slot_; |
| 228 } |
| 229 |
222 protected: | 230 protected: |
223 // Cover method for the method of the same name on the HistoryService. | 231 // Cover method for the method of the same name on the HistoryService. |
224 // url is the one that was visited with the given search terms. | 232 // url is the one that was visited with the given search terms. |
225 // | 233 // |
226 // This exists and is virtual for testing. | 234 // This exists and is virtual for testing. |
227 virtual void SetKeywordSearchTermsForURL(const TemplateURL* t_url, | 235 virtual void SetKeywordSearchTermsForURL(const TemplateURL* t_url, |
228 const GURL& url, | 236 const GURL& url, |
229 const std::wstring& term); | 237 const std::wstring& term); |
230 | 238 |
231 private: | 239 private: |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 // we invoke DeleteGeneratedKeywordsMatchingHost with all the elements of | 366 // we invoke DeleteGeneratedKeywordsMatchingHost with all the elements of |
359 // the vector. | 367 // the vector. |
360 std::vector<std::wstring> hosts_to_delete_; | 368 std::vector<std::wstring> hosts_to_delete_; |
361 | 369 |
362 // All visits that occurred before we finished loading. Once loaded | 370 // All visits that occurred before we finished loading. Once loaded |
363 // UpdateKeywordSearchTermsForURL is invoked for each element of the vector. | 371 // UpdateKeywordSearchTermsForURL is invoked for each element of the vector. |
364 std::vector<history::URLVisitedDetails> visits_to_add_; | 372 std::vector<history::URLVisitedDetails> visits_to_add_; |
365 | 373 |
366 const TemplateURL* default_search_provider_; | 374 const TemplateURL* default_search_provider_; |
367 | 375 |
| 376 // Used for UX testing. Gives the slot in the search engine dialog that was |
| 377 // chosen as the default search engine. |
| 378 int search_engine_dialog_chosen_slot_; |
| 379 |
368 // The default search provider from preferences. This is only valid if | 380 // The default search provider from preferences. This is only valid if |
369 // GetDefaultSearchProvider is invoked and we haven't been loaded or loading | 381 // GetDefaultSearchProvider is invoked and we haven't been loaded or loading |
370 // failed. If loading was successful this is not used. | 382 // failed. If loading was successful this is not used. |
371 scoped_ptr<TemplateURL> prefs_default_search_provider_; | 383 scoped_ptr<TemplateURL> prefs_default_search_provider_; |
372 | 384 |
373 // ID assigned to next TemplateURL added to this model. This is an ever | 385 // ID assigned to next TemplateURL added to this model. This is an ever |
374 // increasing integer that is initialized from the database. | 386 // increasing integer that is initialized from the database. |
375 TemplateURL::IDType next_id_; | 387 TemplateURL::IDType next_id_; |
376 | 388 |
377 // List of extension IDs waiting for Load to have keywords registered. | 389 // List of extension IDs waiting for Load to have keywords registered. |
378 std::vector<std::string> pending_extension_ids_; | 390 std::vector<std::string> pending_extension_ids_; |
379 | 391 |
380 DISALLOW_COPY_AND_ASSIGN(TemplateURLModel); | 392 DISALLOW_COPY_AND_ASSIGN(TemplateURLModel); |
381 }; | 393 }; |
382 | 394 |
383 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_MODEL_H_ | 395 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_MODEL_H_ |
OLD | NEW |