| 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_AUTOCOMPLETE_SHORTCUTS_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_BACKEND_H_ |
| 6 #define CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_BACKEND_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_BACKEND_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 enum CurrentState { | 85 enum CurrentState { |
| 86 NOT_INITIALIZED, // Backend created but not initialized. | 86 NOT_INITIALIZED, // Backend created but not initialized. |
| 87 INITIALIZING, // Init() called, but not completed yet. | 87 INITIALIZING, // Init() called, but not completed yet. |
| 88 INITIALIZED, // Initialization completed, all accessors can be safely | 88 INITIALIZED, // Initialization completed, all accessors can be safely |
| 89 // called. | 89 // called. |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 typedef std::map<std::string, ShortcutMap::iterator> GuidMap; | 92 typedef std::map<std::string, ShortcutMap::iterator> GuidMap; |
| 93 | 93 |
| 94 virtual ~ShortcutsBackend(); | 94 ~ShortcutsBackend() override; |
| 95 | 95 |
| 96 static history::ShortcutsDatabase::Shortcut::MatchCore MatchToMatchCore( | 96 static history::ShortcutsDatabase::Shortcut::MatchCore MatchToMatchCore( |
| 97 const AutocompleteMatch& match, Profile* profile); | 97 const AutocompleteMatch& match, Profile* profile); |
| 98 | 98 |
| 99 // RefcountedKeyedService: | 99 // RefcountedKeyedService: |
| 100 virtual void ShutdownOnUIThread() override; | 100 void ShutdownOnUIThread() override; |
| 101 | 101 |
| 102 // content::NotificationObserver: | 102 // content::NotificationObserver: |
| 103 virtual void Observe(int type, | 103 void Observe(int type, |
| 104 const content::NotificationSource& source, | 104 const content::NotificationSource& source, |
| 105 const content::NotificationDetails& details) override; | 105 const content::NotificationDetails& details) override; |
| 106 | 106 |
| 107 // Internal initialization of the back-end. Posted by Init() to the DB thread. | 107 // Internal initialization of the back-end. Posted by Init() to the DB thread. |
| 108 // On completion posts InitCompleted() back to UI thread. | 108 // On completion posts InitCompleted() back to UI thread. |
| 109 void InitInternal(); | 109 void InitInternal(); |
| 110 | 110 |
| 111 // Finishes initialization on UI thread, notifies all observers. | 111 // Finishes initialization on UI thread, notifies all observers. |
| 112 void InitCompleted(); | 112 void InitCompleted(); |
| 113 | 113 |
| 114 // Adds the Shortcut to the database. | 114 // Adds the Shortcut to the database. |
| 115 bool AddShortcut(const history::ShortcutsDatabase::Shortcut& shortcut); | 115 bool AddShortcut(const history::ShortcutsDatabase::Shortcut& shortcut); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 145 | 145 |
| 146 content::NotificationRegistrar notification_registrar_; | 146 content::NotificationRegistrar notification_registrar_; |
| 147 | 147 |
| 148 // For some unit-test only. | 148 // For some unit-test only. |
| 149 bool no_db_access_; | 149 bool no_db_access_; |
| 150 | 150 |
| 151 DISALLOW_COPY_AND_ASSIGN(ShortcutsBackend); | 151 DISALLOW_COPY_AND_ASSIGN(ShortcutsBackend); |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_BACKEND_H_ | 154 #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_BACKEND_H_ |
| OLD | NEW |