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

Side by Side Diff: chrome/browser/dom_ui/history2_ui.cc

Issue 2941001: Removal of TabContentsDelegate::GetBrowser() interface method. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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
« no previous file with comments | « chrome/browser/dom_ui/dom_ui.cc ('k') | chrome/browser/dom_ui/history_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/dom_ui/history2_ui.h" 5 #include "chrome/browser/dom_ui/history2_ui.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/i18n/time_formatting.h" 10 #include "base/i18n/time_formatting.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/singleton.h" 12 #include "base/singleton.h"
13 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
14 #include "base/string_piece.h" 14 #include "base/string_piece.h"
15 #include "base/thread.h" 15 #include "base/thread.h"
16 #include "base/time.h" 16 #include "base/time.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chrome/browser/bookmarks/bookmark_model.h" 18 #include "chrome/browser/bookmarks/bookmark_model.h"
19 #include "chrome/browser/browser.h" 19 #include "chrome/browser/browser.h"
20 #include "chrome/browser/browser_list.h"
20 #include "chrome/browser/chrome_thread.h" 21 #include "chrome/browser/chrome_thread.h"
21 #include "chrome/browser/dom_ui/dom_ui_favicon_source.h" 22 #include "chrome/browser/dom_ui/dom_ui_favicon_source.h"
22 #include "chrome/browser/metrics/user_metrics.h" 23 #include "chrome/browser/metrics/user_metrics.h"
23 #include "chrome/browser/history/history_types.h" 24 #include "chrome/browser/history/history_types.h"
24 #include "chrome/browser/profile.h" 25 #include "chrome/browser/profile.h"
25 #include "chrome/browser/tab_contents/tab_contents.h" 26 #include "chrome/browser/tab_contents/tab_contents.h"
26 #include "chrome/browser/tab_contents/tab_contents_delegate.h" 27 #include "chrome/browser/tab_contents/tab_contents_delegate.h"
27 #include "chrome/common/jstemplate_builder.h" 28 #include "chrome/common/jstemplate_builder.h"
28 #include "chrome/common/notification_service.h" 29 #include "chrome/common/notification_service.h"
29 #include "chrome/common/time_format.h" 30 #include "chrome/common/time_format.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } 229 }
229 230
230 HistoryService* hs = 231 HistoryService* hs =
231 dom_ui_->GetProfile()->GetHistoryService(Profile::EXPLICIT_ACCESS); 232 dom_ui_->GetProfile()->GetHistoryService(Profile::EXPLICIT_ACCESS);
232 hs->ExpireHistoryBetween( 233 hs->ExpireHistoryBetween(
233 urls, begin_time, end_time, &cancelable_delete_consumer_, 234 urls, begin_time, end_time, &cancelable_delete_consumer_,
234 NewCallback(this, &BrowsingHistoryHandler2::RemoveComplete)); 235 NewCallback(this, &BrowsingHistoryHandler2::RemoveComplete));
235 } 236 }
236 237
237 void BrowsingHistoryHandler2::HandleClearBrowsingData(const Value* value) { 238 void BrowsingHistoryHandler2::HandleClearBrowsingData(const Value* value) {
238 dom_ui_->tab_contents()->delegate()->GetBrowser()-> 239 // TODO(beng): This is an improper direct dependency on Browser. Route this
239 OpenClearBrowsingDataDialog(); 240 // through some sort of delegate.
241 Browser* browser = BrowserList::FindBrowserWithProfile(dom_ui_->GetProfile());
242 if (browser)
243 browser->OpenClearBrowsingDataDialog();
240 } 244 }
241 245
242 void BrowsingHistoryHandler2::QueryComplete( 246 void BrowsingHistoryHandler2::QueryComplete(
243 HistoryService::Handle request_handle, 247 HistoryService::Handle request_handle,
244 history::QueryResults* results) { 248 history::QueryResults* results) {
245 249
246 ListValue results_value; 250 ListValue results_value;
247 base::Time midnight_today = base::Time::Now().LocalMidnight(); 251 base::Time midnight_today = base::Time::Now().LocalMidnight();
248 252
249 for (size_t i = 0; i < results->size(); ++i) { 253 for (size_t i = 0; i < results->size(); ++i) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 const GURL HistoryUI2::GetHistoryURLWithSearchText(const string16& text) { 409 const GURL HistoryUI2::GetHistoryURLWithSearchText(const string16& text) {
406 return GURL(std::string(chrome::kChromeUIHistory2URL) + "#q=" + 410 return GURL(std::string(chrome::kChromeUIHistory2URL) + "#q=" +
407 EscapeQueryParamValue(UTF16ToUTF8(text), true)); 411 EscapeQueryParamValue(UTF16ToUTF8(text), true));
408 } 412 }
409 413
410 // static 414 // static
411 RefCountedMemory* HistoryUI2::GetFaviconResourceBytes() { 415 RefCountedMemory* HistoryUI2::GetFaviconResourceBytes() {
412 return ResourceBundle::GetSharedInstance(). 416 return ResourceBundle::GetSharedInstance().
413 LoadDataResourceBytes(IDR_HISTORY_FAVICON); 417 LoadDataResourceBytes(IDR_HISTORY_FAVICON);
414 } 418 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/dom_ui.cc ('k') | chrome/browser/dom_ui/history_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698