| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/dom_ui/history_ui.h" | 5 #include "chrome/browser/dom_ui/history_ui.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string_piece.h" | 8 #include "base/string_piece.h" |
| 9 #include "base/thread.h" | 9 #include "base/thread.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| 11 #include "base/time_format.h" | 11 #include "base/time_format.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/browser_resources.h" | 13 #include "chrome/browser/browser_resources.h" |
| 14 #include "chrome/browser/metrics/user_metrics.h" | 14 #include "chrome/browser/metrics/user_metrics.h" |
| 15 #include "chrome/browser/history/history_types.h" | 15 #include "chrome/browser/history/history_types.h" |
| 16 #include "chrome/browser/profile.h" | 16 #include "chrome/browser/profile.h" |
| 17 #include "chrome/common/jstemplate_builder.h" | 17 #include "chrome/common/jstemplate_builder.h" |
| 18 #include "chrome/common/l10n_util.h" | 18 #include "chrome/common/l10n_util.h" |
| 19 #include "chrome/common/resource_bundle.h" | 19 #include "chrome/common/resource_bundle.h" |
| 20 #include "chrome/common/time_format.h" | 20 #include "chrome/common/time_format.h" |
| 21 | 21 |
| 22 #include "chromium_strings.h" | 22 #include "chromium_strings.h" |
| 23 #include "generated_resources.h" | 23 #include "generated_resources.h" |
| 24 | 24 |
| 25 using base::Time; | 25 using base::Time; |
| 26 | 26 |
| 27 // HistoryUI is accessible from chrome://history, and the raw HTML is | 27 // HistoryUI is accessible from chrome-ui://history. |
| 28 // accessed from chrome://history. | |
| 29 static const char kHistoryHost[] = "history"; | 28 static const char kHistoryHost[] = "history"; |
| 30 | 29 |
| 31 // Maximum number of search results to return in a given search. We should | 30 // Maximum number of search results to return in a given search. We should |
| 32 // eventually remove this. | 31 // eventually remove this. |
| 33 static const int kMaxSearchResults = 100; | 32 static const int kMaxSearchResults = 100; |
| 34 | 33 |
| 35 //////////////////////////////////////////////////////////////////////////////// | 34 //////////////////////////////////////////////////////////////////////////////// |
| 36 // | 35 // |
| 37 // HistoryHTMLSource | 36 // HistoryHTMLSource |
| 38 // | 37 // |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 //////////////////////////////////////////////////////////////////////////////// | 279 //////////////////////////////////////////////////////////////////////////////// |
| 281 | 280 |
| 282 HistoryUI::HistoryUI(DOMUIContents* contents) : DOMUI(contents) { | 281 HistoryUI::HistoryUI(DOMUIContents* contents) : DOMUI(contents) { |
| 283 } | 282 } |
| 284 | 283 |
| 285 void HistoryUI::Init() { | 284 void HistoryUI::Init() { |
| 286 AddMessageHandler(new BrowsingHistoryHandler(this)); | 285 AddMessageHandler(new BrowsingHistoryHandler(this)); |
| 287 | 286 |
| 288 HistoryUIHTMLSource* html_source = new HistoryUIHTMLSource(); | 287 HistoryUIHTMLSource* html_source = new HistoryUIHTMLSource(); |
| 289 | 288 |
| 290 // Set up the chrome://history/ source. | 289 // Set up the chrome-ui://history/ source. |
| 291 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, | 290 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, |
| 292 NewRunnableMethod(&chrome_url_data_manager, | 291 NewRunnableMethod(&chrome_url_data_manager, |
| 293 &ChromeURLDataManager::AddDataSource, | 292 &ChromeURLDataManager::AddDataSource, |
| 294 html_source)); | 293 html_source)); |
| 295 } | 294 } |
| 296 | 295 |
| 297 // static | 296 // static |
| 298 GURL HistoryUI::GetBaseURL() { | 297 GURL HistoryUI::GetBaseURL() { |
| 299 std::string url = DOMUIContents::GetScheme(); | 298 std::string url = DOMUIContents::GetScheme(); |
| 300 url += "://"; | 299 url += "://"; |
| 301 url += kHistoryHost; | 300 url += kHistoryHost; |
| 302 return GURL(url); | 301 return GURL(url); |
| 303 } | 302 } |
| OLD | NEW |