| 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_UI_WEBUI_HISTORY_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "chrome/browser/cancelable_request.h" | 12 #include "chrome/browser/cancelable_request.h" |
| 13 #include "chrome/browser/history/history.h" | 13 #include "chrome/browser/history/history.h" |
| 14 #include "chrome/browser/history/web_history_service.h" |
| 14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 15 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
| 16 #include "content/public/browser/web_ui_controller.h" | 17 #include "content/public/browser/web_ui_controller.h" |
| 17 #include "content/public/browser/web_ui_message_handler.h" | 18 #include "content/public/browser/web_ui_message_handler.h" |
| 18 | 19 |
| 19 // The handler for Javascript messages related to the "history" view. | 20 // The handler for Javascript messages related to the "history" view. |
| 20 class BrowsingHistoryHandler : public content::WebUIMessageHandler, | 21 class BrowsingHistoryHandler : public content::WebUIMessageHandler, |
| 21 public content::NotificationObserver { | 22 public content::NotificationObserver { |
| 22 public: | 23 public: |
| 23 BrowsingHistoryHandler(); | 24 BrowsingHistoryHandler(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 40 | 41 |
| 41 // Handler for "removeBookmark" message. | 42 // Handler for "removeBookmark" message. |
| 42 void HandleRemoveBookmark(const base::ListValue* args); | 43 void HandleRemoveBookmark(const base::ListValue* args); |
| 43 | 44 |
| 44 // content::NotificationObserver implementation. | 45 // content::NotificationObserver implementation. |
| 45 virtual void Observe(int type, | 46 virtual void Observe(int type, |
| 46 const content::NotificationSource& source, | 47 const content::NotificationSource& source, |
| 47 const content::NotificationDetails& details) OVERRIDE; | 48 const content::NotificationDetails& details) OVERRIDE; |
| 48 | 49 |
| 49 private: | 50 private: |
| 51 // Helper used by handlers getHistory and searchHistory. |
| 52 void QueryHistory(const string16& text_query, |
| 53 const history::QueryOptions& options); |
| 54 |
| 50 // Callback from the history system when the history list is available. | 55 // Callback from the history system when the history list is available. |
| 51 void QueryComplete(HistoryService::Handle request_handle, | 56 void QueryComplete(HistoryService::Handle request_handle, |
| 52 history::QueryResults* results); | 57 history::QueryResults* results); |
| 53 | 58 |
| 59 // Callback from the WebHistory service with results from Web History. |
| 60 void WebHistoryQueryComplete(); |
| 61 |
| 54 // Callback from the history system when visits were deleted. | 62 // Callback from the history system when visits were deleted. |
| 55 void RemoveComplete(); | 63 void RemoveComplete(); |
| 56 | 64 |
| 57 // Extract the arguments from the call to HandleSearchHistory. | 65 // Extract the arguments from the call to HandleSearchHistory. |
| 58 void ExtractSearchHistoryArguments(const base::ListValue* args, | 66 void ExtractSearchHistoryArguments(const base::ListValue* args, |
| 59 int* month, | 67 int* month, |
| 60 string16* query); | 68 string16* query); |
| 61 | 69 |
| 62 // Figure out the query options for a month-wide query. | 70 // Figure out the query options for a month-wide query. |
| 63 history::QueryOptions CreateMonthQueryOptions(int month); | 71 history::QueryOptions CreateMonthQueryOptions(int month); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 86 // Return the URL for a given search term. | 94 // Return the URL for a given search term. |
| 87 static const GURL GetHistoryURLWithSearchText(const string16& text); | 95 static const GURL GetHistoryURLWithSearchText(const string16& text); |
| 88 | 96 |
| 89 static base::RefCountedMemory* GetFaviconResourceBytes(); | 97 static base::RefCountedMemory* GetFaviconResourceBytes(); |
| 90 | 98 |
| 91 private: | 99 private: |
| 92 DISALLOW_COPY_AND_ASSIGN(HistoryUI); | 100 DISALLOW_COPY_AND_ASSIGN(HistoryUI); |
| 93 }; | 101 }; |
| 94 | 102 |
| 95 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ | 103 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ |
| OLD | NEW |