| 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 CHROME_BROWSER_HISTORY_SHORTCUTS_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_SHORTCUTS_BACKEND_H_ |
| 6 #define CHROME_BROWSER_HISTORY_SHORTCUTS_BACKEND_H_ | 6 #define CHROME_BROWSER_HISTORY_SHORTCUTS_BACKEND_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 bool initialized() const { return current_state_ == INITIALIZED; } | 111 bool initialized() const { return current_state_ == INITIALIZED; } |
| 112 const ShortcutMap& shortcuts_map() const { return shortcuts_map_; } | 112 const ShortcutMap& shortcuts_map() const { return shortcuts_map_; } |
| 113 | 113 |
| 114 // Deletes the Shortcuts with the url. | 114 // Deletes the Shortcuts with the url. |
| 115 bool DeleteShortcutsWithUrl(const GURL& shortcut_url); | 115 bool DeleteShortcutsWithUrl(const GURL& shortcut_url); |
| 116 | 116 |
| 117 void AddObserver(ShortcutsBackendObserver* obs); | 117 void AddObserver(ShortcutsBackendObserver* obs); |
| 118 void RemoveObserver(ShortcutsBackendObserver* obs); | 118 void RemoveObserver(ShortcutsBackendObserver* obs); |
| 119 | 119 |
| 120 // Called when a successful omnibox navigation occurs. Adds a corresponding |
| 121 // shortcut. |
| 122 void OnOmniboxNavigation(const string16& text, |
| 123 const AutocompleteMatch& match); |
| 124 |
| 120 private: | 125 private: |
| 121 friend class base::RefCountedThreadSafe<ShortcutsBackend>; | 126 friend class base::RefCountedThreadSafe<ShortcutsBackend>; |
| 122 friend class ShortcutsProviderTest; | 127 friend class ShortcutsProviderTest; |
| 123 FRIEND_TEST_ALL_PREFIXES(ShortcutsBackendTest, AddAndUpdateShortcut); | 128 FRIEND_TEST_ALL_PREFIXES(ShortcutsBackendTest, AddAndUpdateShortcut); |
| 124 FRIEND_TEST_ALL_PREFIXES(ShortcutsBackendTest, DeleteShortcuts); | 129 FRIEND_TEST_ALL_PREFIXES(ShortcutsBackendTest, DeleteShortcuts); |
| 125 | 130 |
| 126 enum CurrentState { | 131 enum CurrentState { |
| 127 NOT_INITIALIZED, // Backend created but not initialized. | 132 NOT_INITIALIZED, // Backend created but not initialized. |
| 128 INITIALIZING, // Init() called, but not completed yet. | 133 INITIALIZING, // Init() called, but not completed yet. |
| 129 INITIALIZED, // Initialization completed, all accessors can be safely | 134 INITIALIZED, // Initialization completed, all accessors can be safely |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 188 |
| 184 // For some unit-test only. | 189 // For some unit-test only. |
| 185 bool no_db_access_; | 190 bool no_db_access_; |
| 186 | 191 |
| 187 DISALLOW_COPY_AND_ASSIGN(ShortcutsBackend); | 192 DISALLOW_COPY_AND_ASSIGN(ShortcutsBackend); |
| 188 }; | 193 }; |
| 189 | 194 |
| 190 } // namespace history | 195 } // namespace history |
| 191 | 196 |
| 192 #endif // CHROME_BROWSER_HISTORY_SHORTCUTS_BACKEND_H_ | 197 #endif // CHROME_BROWSER_HISTORY_SHORTCUTS_BACKEND_H_ |
| OLD | NEW |