| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/md_history_ui.h" | 5 #include "chrome/browser/ui/webui/md_history_ui.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/webui/browsing_history_handler.h" | 9 #include "chrome/browser/ui/webui/browsing_history_handler.h" |
| 10 #include "chrome/browser/ui/webui/metrics_handler.h" | 10 #include "chrome/browser/ui/webui/metrics_handler.h" |
| 11 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
| 12 #include "components/search/search.h" | 12 #include "components/search/search.h" |
| 13 #include "content/public/browser/web_ui.h" | 13 #include "content/public/browser/web_ui.h" |
| 14 #include "content/public/browser/web_ui_data_source.h" | 14 #include "content/public/browser/web_ui_data_source.h" |
| 15 #include "grit/browser_resources.h" | 15 #include "grit/browser_resources.h" |
| 16 #include "grit/components_scaled_resources.h" | 16 #include "grit/components_scaled_resources.h" |
| 17 #include "grit/components_strings.h" | 17 #include "grit/components_strings.h" |
| 18 #include "grit/generated_resources.h" |
| 18 #include "grit/theme_resources.h" | 19 #include "grit/theme_resources.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 20 | 21 |
| 21 #if !defined(OS_ANDROID) | 22 #if !defined(OS_ANDROID) |
| 22 #include "chrome/browser/ui/webui/foreign_session_handler.h" | 23 #include "chrome/browser/ui/webui/foreign_session_handler.h" |
| 23 #include "chrome/browser/ui/webui/history_login_handler.h" | 24 #include "chrome/browser/ui/webui/history_login_handler.h" |
| 24 #endif | 25 #endif |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| 27 | 28 |
| 28 content::WebUIDataSource* CreateMdHistoryUIHTMLSource() { | 29 content::WebUIDataSource* CreateMdHistoryUIHTMLSource() { |
| 29 content::WebUIDataSource* source = | 30 content::WebUIDataSource* source = |
| 30 content::WebUIDataSource::Create(chrome::kChromeUIHistoryHost); | 31 content::WebUIDataSource::Create(chrome::kChromeUIHistoryHost); |
| 31 | 32 |
| 32 // Localized strings (alphabetical order). | 33 // Localized strings (alphabetical order). |
| 34 source->AddLocalizedString("clearSearch", IDS_MD_HISTORY_CLEAR_SEARCH); |
| 35 source->AddLocalizedString("moreFromSite", IDS_HISTORY_MORE_FROM_SITE); |
| 36 source->AddLocalizedString("removeFromHistory", IDS_HISTORY_REMOVE_PAGE); |
| 37 source->AddLocalizedString("search", IDS_MD_HISTORY_SEARCH); |
| 33 source->AddLocalizedString("title", IDS_HISTORY_TITLE); | 38 source->AddLocalizedString("title", IDS_HISTORY_TITLE); |
| 34 | 39 |
| 35 // TODO(tsergeant): File resources (alphabetical order). | 40 source->AddResourcePath("history_card.html", |
| 41 IDR_MD_HISTORY_HISTORY_CARD_HTML); |
| 42 source->AddResourcePath("history_card.js", IDR_MD_HISTORY_HISTORY_CARD_JS); |
| 43 source->AddResourcePath("history_card_manager.html", |
| 44 IDR_MD_HISTORY_HISTORY_CARD_MANAGER_HTML); |
| 45 source->AddResourcePath("history_card_manager.js", |
| 46 IDR_MD_HISTORY_HISTORY_CARD_MANAGER_JS); |
| 47 source->AddResourcePath("history_item.html", |
| 48 IDR_MD_HISTORY_HISTORY_ITEM_HTML); |
| 49 source->AddResourcePath("history_item.js", IDR_MD_HISTORY_HISTORY_ITEM_JS); |
| 50 source->AddResourcePath("history_toolbar.html", |
| 51 IDR_MD_HISTORY_HISTORY_TOOLBAR_HTML); |
| 52 source->AddResourcePath("history_toolbar.js", |
| 53 IDR_MD_HISTORY_HISTORY_TOOLBAR_JS); |
| 54 source->AddResourcePath("history.js", IDR_MD_HISTORY_HISTORY_JS); |
| 36 | 55 |
| 37 source->SetDefaultResource(IDR_MD_HISTORY_HISTORY_HTML); | 56 source->SetDefaultResource(IDR_MD_HISTORY_HISTORY_HTML); |
| 38 source->SetJsonPath("strings.js"); | 57 source->SetJsonPath("strings.js"); |
| 39 | 58 |
| 40 return source; | 59 return source; |
| 41 } | 60 } |
| 42 | 61 |
| 43 } // namespace | 62 } // namespace |
| 44 | 63 |
| 45 MdHistoryUI::MdHistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 64 MdHistoryUI::MdHistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 58 content::WebUIDataSource::Add(profile, CreateMdHistoryUIHTMLSource()); | 77 content::WebUIDataSource::Add(profile, CreateMdHistoryUIHTMLSource()); |
| 59 } | 78 } |
| 60 | 79 |
| 61 MdHistoryUI::~MdHistoryUI() {} | 80 MdHistoryUI::~MdHistoryUI() {} |
| 62 | 81 |
| 63 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes( | 82 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes( |
| 64 ui::ScaleFactor scale_factor) { | 83 ui::ScaleFactor scale_factor) { |
| 65 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | 84 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
| 66 IDR_HISTORY_FAVICON, scale_factor); | 85 IDR_HISTORY_FAVICON, scale_factor); |
| 67 } | 86 } |
| OLD | NEW |