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

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

Issue 1729263005: MD History: Display synced tabs history. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mdh_shared_styles
Patch Set: address comments Created 4 years, 9 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
OLDNEW
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/foreign_session_handler.h" 10 #include "chrome/browser/ui/webui/foreign_session_handler.h"
(...skipping 14 matching lines...) Expand all
25 25
26 namespace { 26 namespace {
27 27
28 content::WebUIDataSource* CreateMdHistoryUIHTMLSource(Profile* profile) { 28 content::WebUIDataSource* CreateMdHistoryUIHTMLSource(Profile* profile) {
29 PrefService* prefs = profile->GetPrefs(); 29 PrefService* prefs = profile->GetPrefs();
30 30
31 content::WebUIDataSource* source = 31 content::WebUIDataSource* source =
32 content::WebUIDataSource::Create(chrome::kChromeUIHistoryHost); 32 content::WebUIDataSource::Create(chrome::kChromeUIHistoryHost);
33 33
34 // Localized strings (alphabetical order). 34 // Localized strings (alphabetical order).
35 source->AddLocalizedString("cancel", IDS_CANCEL);
35 source->AddLocalizedString("clearBrowsingData", 36 source->AddLocalizedString("clearBrowsingData",
36 IDS_CLEAR_BROWSING_DATA_TITLE); 37 IDS_CLEAR_BROWSING_DATA_TITLE);
37 source->AddLocalizedString("clearSearch", IDS_MD_HISTORY_CLEAR_SEARCH); 38 source->AddLocalizedString("clearSearch", IDS_MD_HISTORY_CLEAR_SEARCH);
38 source->AddLocalizedString("cancel", IDS_CANCEL);
39 source->AddLocalizedString("delete", IDS_MD_HISTORY_DELETE); 39 source->AddLocalizedString("delete", IDS_MD_HISTORY_DELETE);
40 source->AddLocalizedString("historyMenuItem",
41 IDS_MD_HISTORY_HISTORY_MENU_ITEM);
40 source->AddLocalizedString("itemsSelected", IDS_MD_HISTORY_ITEMS_SELECTED); 42 source->AddLocalizedString("itemsSelected", IDS_MD_HISTORY_ITEMS_SELECTED);
41 source->AddLocalizedString("moreFromSite", IDS_HISTORY_MORE_FROM_SITE); 43 source->AddLocalizedString("moreFromSite", IDS_HISTORY_MORE_FROM_SITE);
44 source->AddLocalizedString("openAll", IDS_HISTORY_OTHER_SESSIONS_OPEN_ALL);
45 source->AddLocalizedString("openTabsMenuItem",
46 IDS_MD_HISTORY_OPEN_TABS_MENU_ITEM);
42 source->AddLocalizedString("removeFromHistory", IDS_HISTORY_REMOVE_PAGE); 47 source->AddLocalizedString("removeFromHistory", IDS_HISTORY_REMOVE_PAGE);
43 source->AddLocalizedString("search", IDS_MD_HISTORY_SEARCH); 48 source->AddLocalizedString("search", IDS_MD_HISTORY_SEARCH);
44 source->AddLocalizedString("title", IDS_HISTORY_TITLE); 49 source->AddLocalizedString("title", IDS_HISTORY_TITLE);
45 50
46 bool allow_deleting_history = 51 bool allow_deleting_history =
47 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory); 52 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory);
48 source->AddBoolean("allowDeletingHistory", allow_deleting_history); 53 source->AddBoolean("allowDeletingHistory", allow_deleting_history);
49 source->AddResourcePath("history_item.html", 54 source->AddResourcePath("history_item.html",
50 IDR_MD_HISTORY_HISTORY_ITEM_HTML); 55 IDR_MD_HISTORY_HISTORY_ITEM_HTML);
51 source->AddResourcePath("history_item.js", IDR_MD_HISTORY_HISTORY_ITEM_JS); 56 source->AddResourcePath("history_item.js", IDR_MD_HISTORY_HISTORY_ITEM_JS);
52 source->AddResourcePath("history_list.html", 57 source->AddResourcePath("history_list.html",
53 IDR_MD_HISTORY_HISTORY_LIST_HTML); 58 IDR_MD_HISTORY_HISTORY_LIST_HTML);
54 source->AddResourcePath("history_list.js", IDR_MD_HISTORY_HISTORY_LIST_JS); 59 source->AddResourcePath("history_list.js", IDR_MD_HISTORY_HISTORY_LIST_JS);
55 source->AddResourcePath("history_toolbar.html", 60 source->AddResourcePath("history_toolbar.html",
56 IDR_MD_HISTORY_HISTORY_TOOLBAR_HTML); 61 IDR_MD_HISTORY_HISTORY_TOOLBAR_HTML);
57 source->AddResourcePath("history_toolbar.js", 62 source->AddResourcePath("history_toolbar.js",
58 IDR_MD_HISTORY_HISTORY_TOOLBAR_JS); 63 IDR_MD_HISTORY_HISTORY_TOOLBAR_JS);
59 source->AddResourcePath("history.js", IDR_MD_HISTORY_HISTORY_JS); 64 source->AddResourcePath("history.js", IDR_MD_HISTORY_HISTORY_JS);
60 source->AddResourcePath("shared_style.html", 65 source->AddResourcePath("shared_style.html",
61 IDR_MD_HISTORY_SHARED_STYLE_HTML); 66 IDR_MD_HISTORY_SHARED_STYLE_HTML);
67 source->AddResourcePath("side_bar.html", IDR_MD_HISTORY_SIDE_BAR_HTML);
68 source->AddResourcePath("side_bar.js", IDR_MD_HISTORY_SIDE_BAR_JS);
69 source->AddResourcePath("synced_device_card.html",
tsergeant 2016/03/09 04:36:50 We should make sure that our chrome:// paths match
calamity 2016/03/10 04:18:24 N/A
70 IDR_MD_HISTORY_SYNCED_DEVICE_HTML);
71 source->AddResourcePath("synced_device_card.js",
72 IDR_MD_HISTORY_SYNCED_DEVICE_JS);
73 source->AddResourcePath("synced_device_manager.html",
74 IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_HTML);
75 source->AddResourcePath("synced_device_manager.js",
76 IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_JS);
62 77
63 source->SetDefaultResource(IDR_MD_HISTORY_HISTORY_HTML); 78 source->SetDefaultResource(IDR_MD_HISTORY_HISTORY_HTML);
64 source->SetJsonPath("strings.js"); 79 source->SetJsonPath("strings.js");
65 80
66 return source; 81 return source;
67 } 82 }
68 83
69 } // namespace 84 } // namespace
70 85
71 MdHistoryUI::MdHistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) { 86 MdHistoryUI::MdHistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) {
72 web_ui->AddMessageHandler(new BrowsingHistoryHandler()); 87 web_ui->AddMessageHandler(new BrowsingHistoryHandler());
73 web_ui->AddMessageHandler(new MetricsHandler()); 88 web_ui->AddMessageHandler(new MetricsHandler());
74 89
75 if (search::IsInstantExtendedAPIEnabled()) { 90 if (search::IsInstantExtendedAPIEnabled()) {
76 web_ui->AddMessageHandler(new browser_sync::ForeignSessionHandler()); 91 web_ui->AddMessageHandler(new browser_sync::ForeignSessionHandler());
77 web_ui->AddMessageHandler(new HistoryLoginHandler()); 92 web_ui->AddMessageHandler(new HistoryLoginHandler());
78 } 93 }
79 94
80 Profile* profile = Profile::FromWebUI(web_ui); 95 Profile* profile = Profile::FromWebUI(web_ui);
81 content::WebUIDataSource::Add(profile, CreateMdHistoryUIHTMLSource(profile)); 96 content::WebUIDataSource::Add(profile, CreateMdHistoryUIHTMLSource(profile));
82 } 97 }
83 98
84 MdHistoryUI::~MdHistoryUI() {} 99 MdHistoryUI::~MdHistoryUI() {}
85 100
86 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes( 101 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes(
87 ui::ScaleFactor scale_factor) { 102 ui::ScaleFactor scale_factor) {
88 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( 103 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
89 IDR_HISTORY_FAVICON, scale_factor); 104 IDR_HISTORY_FAVICON, scale_factor);
90 } 105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698