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

Side by Side Diff: chrome/browser/ui/webui/history_ui.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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/ui/webui/history_ui.h ('k') | chrome/browser/ui/webui/net_internals_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 #include "chrome/browser/ui/webui/history_ui.h" 5 #include "chrome/browser/ui/webui/history_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/i18n/time_formatting.h" 11 #include "base/i18n/time_formatting.h"
12 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "base/string_number_conversions.h" 15 #include "base/string_number_conversions.h"
16 #include "base/string_piece.h" 16 #include "base/string_piece.h"
17 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
18 #include "base/time.h" 18 #include "base/time.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "base/values.h" 20 #include "base/values.h"
21 #include "chrome/browser/bookmarks/bookmark_model.h" 21 #include "chrome/browser/bookmarks/bookmark_model.h"
22 #include "chrome/browser/history/history_types.h" 22 #include "chrome/browser/history/history_types.h"
23 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
25 #include "chrome/browser/ui/browser_list.h" 25 #include "chrome/browser/ui/browser_list.h"
26 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" 26 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
27 #include "chrome/browser/ui/webui/favicon_source.h" 27 #include "chrome/browser/ui/webui/favicon_source.h"
28 #include "chrome/common/chrome_notification_types.h"
28 #include "chrome/common/jstemplate_builder.h" 29 #include "chrome/common/jstemplate_builder.h"
29 #include "chrome/common/time_format.h" 30 #include "chrome/common/time_format.h"
30 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
31 #include "content/browser/browser_thread.h" 32 #include "content/browser/browser_thread.h"
32 #include "content/browser/tab_contents/tab_contents.h" 33 #include "content/browser/tab_contents/tab_contents.h"
33 #include "content/browser/tab_contents/tab_contents_delegate.h" 34 #include "content/browser/tab_contents/tab_contents_delegate.h"
34 #include "content/browser/user_metrics.h" 35 #include "content/browser/user_metrics.h"
35 #include "content/common/notification_source.h" 36 #include "content/common/notification_source.h"
36 #include "grit/browser_resources.h" 37 #include "grit/browser_resources.h"
37 #include "grit/chromium_strings.h" 38 #include "grit/chromium_strings.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 cancelable_delete_consumer_.CancelAllRequests(); 132 cancelable_delete_consumer_.CancelAllRequests();
132 } 133 }
133 134
134 WebUIMessageHandler* BrowsingHistoryHandler::Attach(WebUI* web_ui) { 135 WebUIMessageHandler* BrowsingHistoryHandler::Attach(WebUI* web_ui) {
135 // Create our favicon data source. 136 // Create our favicon data source.
136 Profile* profile = web_ui->GetProfile(); 137 Profile* profile = web_ui->GetProfile();
137 profile->GetChromeURLDataManager()->AddDataSource( 138 profile->GetChromeURLDataManager()->AddDataSource(
138 new FaviconSource(profile, FaviconSource::FAVICON)); 139 new FaviconSource(profile, FaviconSource::FAVICON));
139 140
140 // Get notifications when history is cleared. 141 // Get notifications when history is cleared.
141 registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, 142 registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED,
142 Source<Profile>(profile->GetOriginalProfile())); 143 Source<Profile>(profile->GetOriginalProfile()));
143 return WebUIMessageHandler::Attach(web_ui); 144 return WebUIMessageHandler::Attach(web_ui);
144 } 145 }
145 146
146 void BrowsingHistoryHandler::RegisterMessages() { 147 void BrowsingHistoryHandler::RegisterMessages() {
147 web_ui_->RegisterMessageCallback("getHistory", 148 web_ui_->RegisterMessageCallback("getHistory",
148 NewCallback(this, &BrowsingHistoryHandler::HandleGetHistory)); 149 NewCallback(this, &BrowsingHistoryHandler::HandleGetHistory));
149 web_ui_->RegisterMessageCallback("searchHistory", 150 web_ui_->RegisterMessageCallback("searchHistory",
150 NewCallback(this, &BrowsingHistoryHandler::HandleSearchHistory)); 151 NewCallback(this, &BrowsingHistoryHandler::HandleSearchHistory));
151 web_ui_->RegisterMessageCallback("removeURLsOnOneDay", 152 web_ui_->RegisterMessageCallback("removeURLsOnOneDay",
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 } else { 359 } else {
359 exploded.month = 12; 360 exploded.month = 12;
360 exploded.year--; 361 exploded.year--;
361 } 362 }
362 options.begin_time = base::Time::FromLocalExploded(exploded); 363 options.begin_time = base::Time::FromLocalExploded(exploded);
363 } 364 }
364 365
365 return options; 366 return options;
366 } 367 }
367 368
368 void BrowsingHistoryHandler::Observe(NotificationType type, 369 void BrowsingHistoryHandler::Observe(int type,
369 const NotificationSource& source, 370 const NotificationSource& source,
370 const NotificationDetails& details) { 371 const NotificationDetails& details) {
371 if (type != NotificationType::HISTORY_URLS_DELETED) { 372 if (type != chrome::NOTIFICATION_HISTORY_URLS_DELETED) {
372 NOTREACHED(); 373 NOTREACHED();
373 return; 374 return;
374 } 375 }
375 376
376 // Some URLs were deleted from history. Reload the list. 377 // Some URLs were deleted from history. Reload the list.
377 web_ui_->CallJavascriptFunction("historyDeleted"); 378 web_ui_->CallJavascriptFunction("historyDeleted");
378 } 379 }
379 380
380 //////////////////////////////////////////////////////////////////////////////// 381 ////////////////////////////////////////////////////////////////////////////////
381 // 382 //
(...skipping 14 matching lines...) Expand all
396 const GURL HistoryUI::GetHistoryURLWithSearchText(const string16& text) { 397 const GURL HistoryUI::GetHistoryURLWithSearchText(const string16& text) {
397 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + 398 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" +
398 EscapeQueryParamValue(UTF16ToUTF8(text), true)); 399 EscapeQueryParamValue(UTF16ToUTF8(text), true));
399 } 400 }
400 401
401 // static 402 // static
402 RefCountedMemory* HistoryUI::GetFaviconResourceBytes() { 403 RefCountedMemory* HistoryUI::GetFaviconResourceBytes() {
403 return ResourceBundle::GetSharedInstance(). 404 return ResourceBundle::GetSharedInstance().
404 LoadDataResourceBytes(IDR_HISTORY_FAVICON); 405 LoadDataResourceBytes(IDR_HISTORY_FAVICON);
405 } 406 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/history_ui.h ('k') | chrome/browser/ui/webui/net_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698