Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: chrome/browser/ui/webui/history2_ui.h

Issue 7086030: Refresh the history page if history entries get deleted, except for when currently editing entries (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/history2.html ('k') | chrome/browser/ui/webui/history2_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_HISTORY2_UI_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_HISTORY2_UI_H_
6 #define CHROME_BROWSER_UI_WEBUI_HISTORY2_UI_H_ 6 #define CHROME_BROWSER_UI_WEBUI_HISTORY2_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/history/history.h" 12 #include "chrome/browser/history/history.h"
13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
14 #include "chrome/browser/ui/webui/chrome_web_ui.h" 14 #include "chrome/browser/ui/webui/chrome_web_ui.h"
15 #include "content/browser/cancelable_request.h" 15 #include "content/browser/cancelable_request.h"
16 #include "content/common/notification_registrar.h"
16 17
17 class GURL; 18 class GURL;
18 19
19 // Temporary fork for development of new history UI. 20 // Temporary fork for development of new history UI.
20 // TODO(pamg): merge back in when new UI is complete. 21 // TODO(pamg): merge back in when new UI is complete.
21 22
22 class HistoryUIHTMLSource2 : public ChromeURLDataManager::DataSource { 23 class HistoryUIHTMLSource2 : public ChromeURLDataManager::DataSource {
23 public: 24 public:
24 HistoryUIHTMLSource2(); 25 HistoryUIHTMLSource2();
25 26
26 // Called when the network layer has requested a resource underneath 27 // Called when the network layer has requested a resource underneath
27 // the path we registered. 28 // the path we registered.
28 virtual void StartDataRequest(const std::string& path, 29 virtual void StartDataRequest(const std::string& path,
29 bool is_incognito, 30 bool is_incognito,
30 int request_id); 31 int request_id);
31 32
32 virtual std::string GetMimeType(const std::string&) const; 33 virtual std::string GetMimeType(const std::string&) const;
33 34
34 private: 35 private:
35 virtual ~HistoryUIHTMLSource2() {} 36 virtual ~HistoryUIHTMLSource2() {}
36 37
37 DISALLOW_COPY_AND_ASSIGN(HistoryUIHTMLSource2); 38 DISALLOW_COPY_AND_ASSIGN(HistoryUIHTMLSource2);
38 }; 39 };
39 40
40 // The handler for Javascript messages related to the "history" view. 41 // The handler for Javascript messages related to the "history" view.
41 class BrowsingHistoryHandler2 : public WebUIMessageHandler { 42 class BrowsingHistoryHandler2 : public WebUIMessageHandler,
43 public NotificationObserver {
42 public: 44 public:
43 BrowsingHistoryHandler2(); 45 BrowsingHistoryHandler2();
44 virtual ~BrowsingHistoryHandler2(); 46 virtual ~BrowsingHistoryHandler2();
45 47
46 // WebUIMessageHandler implementation. 48 // WebUIMessageHandler implementation.
47 virtual WebUIMessageHandler* Attach(WebUI* web_ui); 49 virtual WebUIMessageHandler* Attach(WebUI* web_ui);
48 virtual void RegisterMessages(); 50 virtual void RegisterMessages();
49 51
50 // Callback for the "getHistory" message. 52 // Callback for the "getHistory" message.
51 void HandleGetHistory(const ListValue* args); 53 void HandleGetHistory(const ListValue* args);
52 54
53 // Callback for the "searchHistory" message. 55 // Callback for the "searchHistory" message.
54 void HandleSearchHistory(const ListValue* args); 56 void HandleSearchHistory(const ListValue* args);
55 57
56 // Callback for the "removeURLsOnOneDay" message. 58 // Callback for the "removeURLsOnOneDay" message.
57 void HandleRemoveURLsOnOneDay(const ListValue* args); 59 void HandleRemoveURLsOnOneDay(const ListValue* args);
58 60
59 // Handle for "clearBrowsingData" message. 61 // Handle for "clearBrowsingData" message.
60 void HandleClearBrowsingData(const ListValue* args); 62 void HandleClearBrowsingData(const ListValue* args);
61 63
64 // NotificationObserver implementation.
65 virtual void Observe(NotificationType type,
66 const NotificationSource& source,
67 const NotificationDetails& details);
68
62 private: 69 private:
63 // Callback from the history system when the history list is available. 70 // Callback from the history system when the history list is available.
64 void QueryComplete(HistoryService::Handle request_handle, 71 void QueryComplete(HistoryService::Handle request_handle,
65 history::QueryResults* results); 72 history::QueryResults* results);
66 73
67 // Callback from the history system when visits were deleted. 74 // Callback from the history system when visits were deleted.
68 void RemoveComplete(); 75 void RemoveComplete();
69 76
70 // Extract the arguments from the call to HandleSearchHistory. 77 // Extract the arguments from the call to HandleSearchHistory.
71 void ExtractSearchHistoryArguments(const ListValue* args, 78 void ExtractSearchHistoryArguments(const ListValue* args,
72 int* month, 79 int* month,
73 string16* query); 80 string16* query);
74 81
75 // Figure out the query options for a month-wide query. 82 // Figure out the query options for a month-wide query.
76 history::QueryOptions CreateMonthQueryOptions(int month); 83 history::QueryOptions CreateMonthQueryOptions(int month);
77 84
85 NotificationRegistrar registrar_;
86
78 // Current search text. 87 // Current search text.
79 string16 search_text_; 88 string16 search_text_;
80 89
81 // Our consumer for search requests to the history service. 90 // Our consumer for search requests to the history service.
82 CancelableRequestConsumerT<int, 0> cancelable_search_consumer_; 91 CancelableRequestConsumerT<int, 0> cancelable_search_consumer_;
83 92
84 // Our consumer for delete requests to the history service. 93 // Our consumer for delete requests to the history service.
85 CancelableRequestConsumerT<int, 0> cancelable_delete_consumer_; 94 CancelableRequestConsumerT<int, 0> cancelable_delete_consumer_;
86 95
87 DISALLOW_COPY_AND_ASSIGN(BrowsingHistoryHandler2); 96 DISALLOW_COPY_AND_ASSIGN(BrowsingHistoryHandler2);
88 }; 97 };
89 98
90 class HistoryUI2 : public ChromeWebUI { 99 class HistoryUI2 : public ChromeWebUI {
91 public: 100 public:
92 explicit HistoryUI2(TabContents* contents); 101 explicit HistoryUI2(TabContents* contents);
93 102
94 // Return the URL for a given search term. 103 // Return the URL for a given search term.
95 static const GURL GetHistoryURLWithSearchText(const string16& text); 104 static const GURL GetHistoryURLWithSearchText(const string16& text);
96 105
97 static RefCountedMemory* GetFaviconResourceBytes(); 106 static RefCountedMemory* GetFaviconResourceBytes();
98 107
99 private: 108 private:
100 DISALLOW_COPY_AND_ASSIGN(HistoryUI2); 109 DISALLOW_COPY_AND_ASSIGN(HistoryUI2);
101 }; 110 };
102 111
103 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY2_UI_H_ 112 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY2_UI_H_
OLDNEW
« no previous file with comments | « chrome/browser/resources/history2.html ('k') | chrome/browser/ui/webui/history2_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698