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

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

Issue 11975053: History: Add option to group visits by domain (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Replace images with characters and minor fix. Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
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"
11 #include "base/command_line.h"
11 #include "base/i18n/rtl.h" 12 #include "base/i18n/rtl.h"
12 #include "base/i18n/time_formatting.h" 13 #include "base/i18n/time_formatting.h"
13 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
14 #include "base/message_loop.h" 15 #include "base/message_loop.h"
15 #include "base/string16.h" 16 #include "base/string16.h"
16 #include "base/string_number_conversions.h" 17 #include "base/string_number_conversions.h"
17 #include "base/string_piece.h" 18 #include "base/string_piece.h"
18 #include "base/threading/thread.h" 19 #include "base/threading/thread.h"
19 #include "base/time.h" 20 #include "base/time.h"
20 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
21 #include "base/values.h" 22 #include "base/values.h"
22 #include "chrome/browser/bookmarks/bookmark_model.h" 23 #include "chrome/browser/bookmarks/bookmark_model.h"
23 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 24 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
24 #include "chrome/browser/bookmarks/bookmark_utils.h" 25 #include "chrome/browser/bookmarks/bookmark_utils.h"
25 #include "chrome/browser/history/history_notifications.h" 26 #include "chrome/browser/history/history_notifications.h"
26 #include "chrome/browser/history/history_service_factory.h" 27 #include "chrome/browser/history/history_service_factory.h"
27 #include "chrome/browser/history/history_types.h" 28 #include "chrome/browser/history/history_types.h"
28 #include "chrome/browser/history/web_history_service.h" 29 #include "chrome/browser/history/web_history_service.h"
29 #include "chrome/browser/history/web_history_service_factory.h" 30 #include "chrome/browser/history/web_history_service_factory.h"
30 #include "chrome/browser/profiles/profile.h" 31 #include "chrome/browser/profiles/profile.h"
31 #include "chrome/browser/ui/browser.h" 32 #include "chrome/browser/ui/browser.h"
32 #include "chrome/browser/ui/browser_finder.h" 33 #include "chrome/browser/ui/browser_finder.h"
33 #include "chrome/browser/ui/chrome_pages.h" 34 #include "chrome/browser/ui/chrome_pages.h"
34 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 35 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
35 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" 36 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
36 #include "chrome/browser/ui/webui/favicon_source.h" 37 #include "chrome/browser/ui/webui/favicon_source.h"
37 #include "chrome/common/chrome_notification_types.h" 38 #include "chrome/common/chrome_notification_types.h"
39 #include "chrome/common/chrome_switches.h"
38 #include "chrome/common/time_format.h" 40 #include "chrome/common/time_format.h"
39 #include "chrome/common/url_constants.h" 41 #include "chrome/common/url_constants.h"
40 #include "content/public/browser/notification_details.h" 42 #include "content/public/browser/notification_details.h"
41 #include "content/public/browser/notification_source.h" 43 #include "content/public/browser/notification_source.h"
42 #include "content/public/browser/user_metrics.h" 44 #include "content/public/browser/user_metrics.h"
43 #include "content/public/browser/web_contents.h" 45 #include "content/public/browser/web_contents.h"
44 #include "content/public/browser/web_contents_delegate.h" 46 #include "content/public/browser/web_contents_delegate.h"
45 #include "content/public/browser/web_ui.h" 47 #include "content/public/browser/web_ui.h"
46 #include "grit/browser_resources.h" 48 #include "grit/browser_resources.h"
47 #include "grit/chromium_strings.h" 49 #include "grit/chromium_strings.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 ChromeWebUIDataSource::Create(chrome::kChromeUIHistoryFrameHost); 112 ChromeWebUIDataSource::Create(chrome::kChromeUIHistoryFrameHost);
111 source->AddLocalizedString("loading", IDS_HISTORY_LOADING); 113 source->AddLocalizedString("loading", IDS_HISTORY_LOADING);
112 source->AddLocalizedString("title", IDS_HISTORY_TITLE); 114 source->AddLocalizedString("title", IDS_HISTORY_TITLE);
113 source->AddLocalizedString("newest", IDS_HISTORY_NEWEST); 115 source->AddLocalizedString("newest", IDS_HISTORY_NEWEST);
114 source->AddLocalizedString("newer", IDS_HISTORY_NEWER); 116 source->AddLocalizedString("newer", IDS_HISTORY_NEWER);
115 source->AddLocalizedString("older", IDS_HISTORY_OLDER); 117 source->AddLocalizedString("older", IDS_HISTORY_OLDER);
116 source->AddLocalizedString("searchresultsfor", IDS_HISTORY_SEARCHRESULTSFOR); 118 source->AddLocalizedString("searchresultsfor", IDS_HISTORY_SEARCHRESULTSFOR);
117 source->AddLocalizedString("history", IDS_HISTORY_BROWSERESULTS); 119 source->AddLocalizedString("history", IDS_HISTORY_BROWSERESULTS);
118 source->AddLocalizedString("cont", IDS_HISTORY_CONTINUED); 120 source->AddLocalizedString("cont", IDS_HISTORY_CONTINUED);
119 source->AddLocalizedString("searchbutton", IDS_HISTORY_SEARCH_BUTTON); 121 source->AddLocalizedString("searchbutton", IDS_HISTORY_SEARCH_BUTTON);
122 source->AddLocalizedString("nosearchresults", IDS_HISTORY_NO_SEARCH_RESULTS);
120 source->AddLocalizedString("noresults", IDS_HISTORY_NO_RESULTS); 123 source->AddLocalizedString("noresults", IDS_HISTORY_NO_RESULTS);
121 source->AddLocalizedString("noitems", IDS_HISTORY_NO_ITEMS); 124 source->AddLocalizedString("noitems", IDS_HISTORY_NO_ITEMS);
122 source->AddLocalizedString("edithistory", IDS_HISTORY_START_EDITING_HISTORY); 125 source->AddLocalizedString("edithistory", IDS_HISTORY_START_EDITING_HISTORY);
123 source->AddLocalizedString("doneediting", IDS_HISTORY_STOP_EDITING_HISTORY); 126 source->AddLocalizedString("doneediting", IDS_HISTORY_STOP_EDITING_HISTORY);
124 source->AddLocalizedString("removeselected", 127 source->AddLocalizedString("removeselected",
125 IDS_HISTORY_REMOVE_SELECTED_ITEMS); 128 IDS_HISTORY_REMOVE_SELECTED_ITEMS);
126 source->AddLocalizedString("clearallhistory", 129 source->AddLocalizedString("clearallhistory",
127 IDS_HISTORY_OPEN_CLEAR_BROWSING_DATA_DIALOG); 130 IDS_HISTORY_OPEN_CLEAR_BROWSING_DATA_DIALOG);
128 source->AddString( 131 source->AddString(
129 "deletewarning", 132 "deletewarning",
130 l10n_util::GetStringFUTF16(IDS_HISTORY_DELETE_PRIOR_VISITS_WARNING, 133 l10n_util::GetStringFUTF16(IDS_HISTORY_DELETE_PRIOR_VISITS_WARNING,
131 UTF8ToUTF16(kIncognitoModeShortcut))); 134 UTF8ToUTF16(kIncognitoModeShortcut)));
132 source->AddLocalizedString("actionMenuDescription", 135 source->AddLocalizedString("actionMenuDescription",
133 IDS_HISTORY_ACTION_MENU_DESCRIPTION); 136 IDS_HISTORY_ACTION_MENU_DESCRIPTION);
134 source->AddLocalizedString("removeFromHistory", IDS_HISTORY_REMOVE_PAGE); 137 source->AddLocalizedString("removeFromHistory", IDS_HISTORY_REMOVE_PAGE);
135 source->AddLocalizedString("moreFromSite", IDS_HISTORY_MORE_FROM_SITE); 138 source->AddLocalizedString("moreFromSite", IDS_HISTORY_MORE_FROM_SITE);
136 source->SetJsonPath(kStringsJsFile); 139 source->SetJsonPath(kStringsJsFile);
137 source->AddResourcePath(kHistoryJsFile, IDR_HISTORY_JS); 140 source->AddResourcePath(kHistoryJsFile, IDR_HISTORY_JS);
138 source->SetDefaultResource(IDR_HISTORY_HTML); 141 source->SetDefaultResource(IDR_HISTORY_HTML);
139 source->SetUseJsonJSFormatV2(); 142 source->SetUseJsonJSFormatV2();
143 source->AddLocalizedString("displayfiltersites", IDS_GROUP_BY_DOMAIN_LABEL);
144 source->AddLocalizedString("numbervisits", IDS_HISTORY_NUMBER_VISITS);
145 source->AddBoolean("groupByDomain",
146 CommandLine::ForCurrentProcess()->HasSwitch(
147 switches::kHistoryEnableGroupByDomain));
148
140 return source; 149 return source;
141 } 150 }
142 151
143 } // namespace 152 } // namespace
144 153
145 //////////////////////////////////////////////////////////////////////////////// 154 ////////////////////////////////////////////////////////////////////////////////
146 // 155 //
147 // BrowsingHistoryHandler 156 // BrowsingHistoryHandler
148 // 157 //
149 //////////////////////////////////////////////////////////////////////////////// 158 ////////////////////////////////////////////////////////////////////////////////
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + 524 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" +
516 net::EscapeQueryParamValue(UTF16ToUTF8(text), true)); 525 net::EscapeQueryParamValue(UTF16ToUTF8(text), true));
517 } 526 }
518 527
519 // static 528 // static
520 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( 529 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes(
521 ui::ScaleFactor scale_factor) { 530 ui::ScaleFactor scale_factor) {
522 return ResourceBundle::GetSharedInstance(). 531 return ResourceBundle::GetSharedInstance().
523 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); 532 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor);
524 } 533 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698