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

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 21 matching lines...) Expand all
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("cancel", IDS_CANCEL);
36 source->AddLocalizedString("clearBrowsingData", 36 source->AddLocalizedString("clearBrowsingData",
37 IDS_CLEAR_BROWSING_DATA_TITLE); 37 IDS_CLEAR_BROWSING_DATA_TITLE);
38 source->AddLocalizedString("clearSearch", IDS_MD_HISTORY_CLEAR_SEARCH); 38 source->AddLocalizedString("clearSearch", IDS_MD_HISTORY_CLEAR_SEARCH);
39 source->AddLocalizedString("delete", IDS_MD_HISTORY_DELETE); 39 source->AddLocalizedString("delete", IDS_MD_HISTORY_DELETE);
40 source->AddLocalizedString("foundSearchResults", 40 source->AddLocalizedString("foundSearchResults",
41 IDS_HISTORY_FOUND_SEARCH_RESULTS); 41 IDS_HISTORY_FOUND_SEARCH_RESULTS);
42 source->AddLocalizedString("historyMenuItem",
43 IDS_MD_HISTORY_HISTORY_MENU_ITEM);
42 source->AddLocalizedString("itemsSelected", IDS_MD_HISTORY_ITEMS_SELECTED); 44 source->AddLocalizedString("itemsSelected", IDS_MD_HISTORY_ITEMS_SELECTED);
43 source->AddLocalizedString("moreFromSite", IDS_HISTORY_MORE_FROM_SITE); 45 source->AddLocalizedString("moreFromSite", IDS_HISTORY_MORE_FROM_SITE);
46 source->AddLocalizedString("openAll", IDS_HISTORY_OTHER_SESSIONS_OPEN_ALL);
47 source->AddLocalizedString("openTabsMenuItem",
48 IDS_MD_HISTORY_OPEN_TABS_MENU_ITEM);
44 source->AddLocalizedString("noResults", IDS_HISTORY_NO_RESULTS); 49 source->AddLocalizedString("noResults", IDS_HISTORY_NO_RESULTS);
45 source->AddLocalizedString("noSearchResults", IDS_HISTORY_NO_SEARCH_RESULTS); 50 source->AddLocalizedString("noSearchResults", IDS_HISTORY_NO_SEARCH_RESULTS);
46 source->AddLocalizedString("removeFromHistory", IDS_HISTORY_REMOVE_PAGE); 51 source->AddLocalizedString("removeFromHistory", IDS_HISTORY_REMOVE_PAGE);
47 source->AddLocalizedString("search", IDS_MD_HISTORY_SEARCH); 52 source->AddLocalizedString("search", IDS_MD_HISTORY_SEARCH);
48 source->AddLocalizedString("searchResult", IDS_HISTORY_SEARCH_RESULT); 53 source->AddLocalizedString("searchResult", IDS_HISTORY_SEARCH_RESULT);
49 source->AddLocalizedString("searchResults", IDS_HISTORY_SEARCH_RESULTS); 54 source->AddLocalizedString("searchResults", IDS_HISTORY_SEARCH_RESULTS);
50 source->AddLocalizedString("title", IDS_HISTORY_TITLE); 55 source->AddLocalizedString("title", IDS_HISTORY_TITLE);
51 56
52 bool allow_deleting_history = 57 bool allow_deleting_history =
53 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory); 58 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory);
54 source->AddBoolean("allowDeletingHistory", allow_deleting_history); 59 source->AddBoolean("allowDeletingHistory", allow_deleting_history);
55 source->AddResourcePath("constants.html", IDR_MD_HISTORY_CONSTANTS_HTML); 60 source->AddResourcePath("constants.html", IDR_MD_HISTORY_CONSTANTS_HTML);
56 source->AddResourcePath("constants.js", IDR_MD_HISTORY_CONSTANTS_JS); 61 source->AddResourcePath("constants.js", IDR_MD_HISTORY_CONSTANTS_JS);
57 source->AddResourcePath("history_item.html", 62 source->AddResourcePath("history_item.html",
58 IDR_MD_HISTORY_HISTORY_ITEM_HTML); 63 IDR_MD_HISTORY_HISTORY_ITEM_HTML);
59 source->AddResourcePath("history_item.js", IDR_MD_HISTORY_HISTORY_ITEM_JS); 64 source->AddResourcePath("history_item.js", IDR_MD_HISTORY_HISTORY_ITEM_JS);
60 source->AddResourcePath("history_list.html", 65 source->AddResourcePath("history_list.html",
61 IDR_MD_HISTORY_HISTORY_LIST_HTML); 66 IDR_MD_HISTORY_HISTORY_LIST_HTML);
62 source->AddResourcePath("history_list.js", IDR_MD_HISTORY_HISTORY_LIST_JS); 67 source->AddResourcePath("history_list.js", IDR_MD_HISTORY_HISTORY_LIST_JS);
63 source->AddResourcePath("history_toolbar.html", 68 source->AddResourcePath("history_toolbar.html",
64 IDR_MD_HISTORY_HISTORY_TOOLBAR_HTML); 69 IDR_MD_HISTORY_HISTORY_TOOLBAR_HTML);
65 source->AddResourcePath("history_toolbar.js", 70 source->AddResourcePath("history_toolbar.js",
66 IDR_MD_HISTORY_HISTORY_TOOLBAR_JS); 71 IDR_MD_HISTORY_HISTORY_TOOLBAR_JS);
67 source->AddResourcePath("history.js", IDR_MD_HISTORY_HISTORY_JS); 72 source->AddResourcePath("history.js", IDR_MD_HISTORY_HISTORY_JS);
68 source->AddResourcePath("shared_style.html", 73 source->AddResourcePath("shared_style.html",
69 IDR_MD_HISTORY_SHARED_STYLE_HTML); 74 IDR_MD_HISTORY_SHARED_STYLE_HTML);
75 source->AddResourcePath("side_bar.html", IDR_MD_HISTORY_SIDE_BAR_HTML);
76 source->AddResourcePath("side_bar.js", IDR_MD_HISTORY_SIDE_BAR_JS);
77 source->AddResourcePath("synced_device_card.html",
78 IDR_MD_HISTORY_SYNCED_DEVICE_CARD_HTML);
79 source->AddResourcePath("synced_device_card.js",
80 IDR_MD_HISTORY_SYNCED_DEVICE_CARD_JS);
81 source->AddResourcePath("synced_device_manager.html",
82 IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_HTML);
83 source->AddResourcePath("synced_device_manager.js",
84 IDR_MD_HISTORY_SYNCED_DEVICE_MANAGER_JS);
70 85
71 source->SetDefaultResource(IDR_MD_HISTORY_HISTORY_HTML); 86 source->SetDefaultResource(IDR_MD_HISTORY_HISTORY_HTML);
72 source->SetJsonPath("strings.js"); 87 source->SetJsonPath("strings.js");
73 88
74 return source; 89 return source;
75 } 90 }
76 91
77 } // namespace 92 } // namespace
78 93
79 MdHistoryUI::MdHistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) { 94 MdHistoryUI::MdHistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) {
80 web_ui->AddMessageHandler(new BrowsingHistoryHandler()); 95 web_ui->AddMessageHandler(new BrowsingHistoryHandler());
81 web_ui->AddMessageHandler(new MetricsHandler()); 96 web_ui->AddMessageHandler(new MetricsHandler());
82 97
83 if (search::IsInstantExtendedAPIEnabled()) { 98 if (search::IsInstantExtendedAPIEnabled()) {
84 web_ui->AddMessageHandler(new browser_sync::ForeignSessionHandler()); 99 web_ui->AddMessageHandler(new browser_sync::ForeignSessionHandler());
85 web_ui->AddMessageHandler(new HistoryLoginHandler()); 100 web_ui->AddMessageHandler(new HistoryLoginHandler());
86 } 101 }
87 102
88 Profile* profile = Profile::FromWebUI(web_ui); 103 Profile* profile = Profile::FromWebUI(web_ui);
89 content::WebUIDataSource::Add(profile, CreateMdHistoryUIHTMLSource(profile)); 104 content::WebUIDataSource::Add(profile, CreateMdHistoryUIHTMLSource(profile));
90 } 105 }
91 106
92 MdHistoryUI::~MdHistoryUI() {} 107 MdHistoryUI::~MdHistoryUI() {}
93 108
94 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes( 109 base::RefCountedMemory* MdHistoryUI::GetFaviconResourceBytes(
95 ui::ScaleFactor scale_factor) { 110 ui::ScaleFactor scale_factor) {
96 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( 111 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
97 IDR_HISTORY_FAVICON, scale_factor); 112 IDR_HISTORY_FAVICON, scale_factor);
98 } 113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698