Chromium Code Reviews| 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_strings.h" | 16 #include "grit/components_strings.h" |
| 17 #include "grit/generated_resources.h" | |
| 17 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 19 | 20 |
| 20 #if !defined(OS_ANDROID) | 21 #if !defined(OS_ANDROID) |
| 21 #include "chrome/browser/ui/webui/foreign_session_handler.h" | 22 #include "chrome/browser/ui/webui/foreign_session_handler.h" |
| 22 #include "chrome/browser/ui/webui/history_login_handler.h" | 23 #include "chrome/browser/ui/webui/history_login_handler.h" |
| 23 #endif | 24 #endif |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 content::WebUIDataSource* CreateMdHistoryUIHTMLSource() { | 28 content::WebUIDataSource* CreateMdHistoryUIHTMLSource() { |
| 28 content::WebUIDataSource* source = | 29 content::WebUIDataSource* source = |
| 29 content::WebUIDataSource::Create(chrome::kChromeUIHistoryHost); | 30 content::WebUIDataSource::Create(chrome::kChromeUIHistoryHost); |
| 30 | 31 |
| 31 // Localized strings (alphabetical order). | 32 // Localized strings (alphabetical order). |
| 33 source->AddLocalizedString("moreFromSite", IDS_HISTORY_MORE_FROM_SITE); | |
|
tsergeant
2016/01/19 03:43:46
Can you sort these, please?
hsampson
2016/01/19 03:56:50
Done, thank you.
| |
| 34 source->AddLocalizedString("removeFromHistory", IDS_HISTORY_REMOVE_PAGE); | |
| 32 source->AddLocalizedString("title", IDS_HISTORY_TITLE); | 35 source->AddLocalizedString("title", IDS_HISTORY_TITLE); |
| 36 source->AddLocalizedString("clearSearch", IDS_MD_HISTORY_CLEAR_SEARCH); | |
| 37 source->AddLocalizedString("search", IDS_MD_HISTORY_SEARCH); | |
| 33 | 38 |
| 34 // TODO(tsergeant): File resources (alphabetical order). | 39 source->AddResourcePath("history_card.html", |
| 40 IDR_MD_HISTORY_HISTORY_CARD_HTML); | |
| 41 source->AddResourcePath("history_card.js", IDR_MD_HISTORY_HISTORY_CARD_JS); | |
| 42 source->AddResourcePath("history_card_manager.html", | |
| 43 IDR_MD_HISTORY_HISTORY_CARD_MANAGER_HTML); | |
| 44 source->AddResourcePath("history_card_manager.js", | |
| 45 IDR_MD_HISTORY_HISTORY_CARD_MANAGER_JS); | |
| 46 source->AddResourcePath("history_item.html", | |
| 47 IDR_MD_HISTORY_HISTORY_ITEM_HTML); | |
| 48 source->AddResourcePath("history_item.js", IDR_MD_HISTORY_HISTORY_ITEM_JS); | |
| 49 source->AddResourcePath("history_toolbar.html", | |
| 50 IDR_MD_HISTORY_HISTORY_TOOLBAR_HTML); | |
| 51 source->AddResourcePath("history_toolbar.js", | |
| 52 IDR_MD_HISTORY_HISTORY_TOOLBAR_JS); | |
| 53 source->AddResourcePath("history.js", IDR_MD_HISTORY_HISTORY_JS); | |
| 35 | 54 |
| 36 source->SetDefaultResource(IDR_MD_HISTORY_HISTORY_HTML); | 55 source->SetDefaultResource(IDR_MD_HISTORY_HISTORY_HTML); |
| 37 source->SetJsonPath("strings.js"); | 56 source->SetJsonPath("strings.js"); |
| 38 | 57 |
| 39 return source; | 58 return source; |
| 40 } | 59 } |
| 41 | 60 |
| 42 } // namespace | 61 } // namespace |
| 43 | 62 |
| 44 MdHistoryUI::MdHistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 63 MdHistoryUI::MdHistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 57 content::WebUIDataSource::Add(profile, CreateMdHistoryUIHTMLSource()); | 76 content::WebUIDataSource::Add(profile, CreateMdHistoryUIHTMLSource()); |
| 58 } | 77 } |
| 59 | 78 |
| 60 MdHistoryUI::~MdHistoryUI() {} | 79 MdHistoryUI::~MdHistoryUI() {} |
| 61 | 80 |
| 62 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes( | 81 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes( |
| 63 ui::ScaleFactor scale_factor) { | 82 ui::ScaleFactor scale_factor) { |
| 64 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | 83 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
| 65 IDR_HISTORY_FAVICON, scale_factor); | 84 IDR_HISTORY_FAVICON, scale_factor); |
| 66 } | 85 } |
| OLD | NEW |