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 #include "chrome/browser/ui/webui/history_ui.h" | 5 #include "chrome/browser/ui/webui/history_ui.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 web_ui()->CallJavascriptFunction("historyDeleted"); | 416 web_ui()->CallJavascriptFunction("historyDeleted"); |
417 } | 417 } |
418 } | 418 } |
419 | 419 |
420 //////////////////////////////////////////////////////////////////////////////// | 420 //////////////////////////////////////////////////////////////////////////////// |
421 // | 421 // |
422 // HistoryUI | 422 // HistoryUI |
423 // | 423 // |
424 //////////////////////////////////////////////////////////////////////////////// | 424 //////////////////////////////////////////////////////////////////////////////// |
425 | 425 |
426 HistoryUI::HistoryUI(WebContents* contents) : WebUI(contents, this) { | 426 HistoryUI::HistoryUI(WebUI* web_ui) : WebUIController(web_ui) { |
427 AddMessageHandler(new BrowsingHistoryHandler()); | 427 web_ui->AddMessageHandler(new BrowsingHistoryHandler()); |
428 | 428 |
429 HistoryUIHTMLSource* html_source = new HistoryUIHTMLSource(); | 429 HistoryUIHTMLSource* html_source = new HistoryUIHTMLSource(); |
430 | 430 |
431 // Set up the chrome://history/ source. | 431 // Set up the chrome://history/ source. |
432 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 432 Profile* profile = Profile::FromBrowserContext( |
| 433 web_ui->web_contents()->GetBrowserContext()); |
433 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 434 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
434 } | 435 } |
435 | 436 |
436 // static | 437 // static |
437 const GURL HistoryUI::GetHistoryURLWithSearchText(const string16& text) { | 438 const GURL HistoryUI::GetHistoryURLWithSearchText(const string16& text) { |
438 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + | 439 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + |
439 net::EscapeQueryParamValue(UTF16ToUTF8(text), true)); | 440 net::EscapeQueryParamValue(UTF16ToUTF8(text), true)); |
440 } | 441 } |
441 | 442 |
442 // static | 443 // static |
443 RefCountedMemory* HistoryUI::GetFaviconResourceBytes() { | 444 RefCountedMemory* HistoryUI::GetFaviconResourceBytes() { |
444 return ResourceBundle::GetSharedInstance(). | 445 return ResourceBundle::GetSharedInstance(). |
445 LoadDataResourceBytes(IDR_HISTORY_FAVICON); | 446 LoadDataResourceBytes(IDR_HISTORY_FAVICON); |
446 } | 447 } |
OLD | NEW |