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 #ifndef COMPONENTS_OMNIBOX_BROWSER_SHORTCUTS_BACKEND_H_ | 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_SHORTCUTS_BACKEND_H_ |
6 #define COMPONENTS_OMNIBOX_BROWSER_SHORTCUTS_BACKEND_H_ | 6 #define COMPONENTS_OMNIBOX_BROWSER_SHORTCUTS_BACKEND_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 void AddObserver(ShortcutsBackendObserver* obs); | 82 void AddObserver(ShortcutsBackendObserver* obs); |
83 void RemoveObserver(ShortcutsBackendObserver* obs); | 83 void RemoveObserver(ShortcutsBackendObserver* obs); |
84 | 84 |
85 // Looks for an existing shortcut to match.destination_url that starts with | 85 // Looks for an existing shortcut to match.destination_url that starts with |
86 // |text|. Updates that shortcut if found, otherwise adds a new shortcut. | 86 // |text|. Updates that shortcut if found, otherwise adds a new shortcut. |
87 void AddOrUpdateShortcut(const base::string16& text, | 87 void AddOrUpdateShortcut(const base::string16& text, |
88 const AutocompleteMatch& match); | 88 const AutocompleteMatch& match); |
89 | 89 |
90 private: | 90 private: |
91 friend class base::RefCountedThreadSafe<ShortcutsBackend>; | 91 friend class base::RefCountedThreadSafe<ShortcutsBackend>; |
| 92 friend class ShortcutsProviderExtensionTest; |
92 friend class ShortcutsProviderTest; | 93 friend class ShortcutsProviderTest; |
93 friend class ShortcutsBackendTest; | 94 friend class ShortcutsBackendTest; |
94 FRIEND_TEST_ALL_PREFIXES(ShortcutsBackendTest, EntitySuggestionTest); | 95 FRIEND_TEST_ALL_PREFIXES(ShortcutsBackendTest, EntitySuggestionTest); |
95 | 96 |
96 enum CurrentState { | 97 enum CurrentState { |
97 NOT_INITIALIZED, // Backend created but not initialized. | 98 NOT_INITIALIZED, // Backend created but not initialized. |
98 INITIALIZING, // Init() called, but not completed yet. | 99 INITIALIZING, // Init() called, but not completed yet. |
99 INITIALIZED, // Initialization completed, all accessors can be safely | 100 INITIALIZED, // Initialization completed, all accessors can be safely |
100 // called. | 101 // called. |
101 }; | 102 }; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 scoped_refptr<base::SequencedTaskRunner> main_runner_; | 167 scoped_refptr<base::SequencedTaskRunner> main_runner_; |
167 scoped_refptr<base::SequencedTaskRunner> db_runner_; | 168 scoped_refptr<base::SequencedTaskRunner> db_runner_; |
168 | 169 |
169 // For some unit-test only. | 170 // For some unit-test only. |
170 bool no_db_access_; | 171 bool no_db_access_; |
171 | 172 |
172 DISALLOW_COPY_AND_ASSIGN(ShortcutsBackend); | 173 DISALLOW_COPY_AND_ASSIGN(ShortcutsBackend); |
173 }; | 174 }; |
174 | 175 |
175 #endif // COMPONENTS_OMNIBOX_BROWSER_SHORTCUTS_BACKEND_H_ | 176 #endif // COMPONENTS_OMNIBOX_BROWSER_SHORTCUTS_BACKEND_H_ |
OLD | NEW |