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

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

Issue 10391158: Moves methods for finding browsers to browser_finder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Include fixs Created 8 years, 7 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/i18n/time_formatting.h" 11 #include "base/i18n/time_formatting.h"
12 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "base/string_number_conversions.h" 15 #include "base/string_number_conversions.h"
16 #include "base/string_piece.h" 16 #include "base/string_piece.h"
17 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
18 #include "base/time.h" 18 #include "base/time.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "base/values.h" 20 #include "base/values.h"
21 #include "chrome/browser/bookmarks/bookmark_model.h" 21 #include "chrome/browser/bookmarks/bookmark_model.h"
22 #include "chrome/browser/bookmarks/bookmark_utils.h" 22 #include "chrome/browser/bookmarks/bookmark_utils.h"
23 #include "chrome/browser/history/history_notifications.h" 23 #include "chrome/browser/history/history_notifications.h"
24 #include "chrome/browser/history/history_types.h" 24 #include "chrome/browser/history/history_types.h"
25 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/ui/browser.h" 26 #include "chrome/browser/ui/browser.h"
27 #include "chrome/browser/ui/browser_list.h" 27 #include "chrome/browser/ui/browser_finder.h"
28 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 28 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
29 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" 29 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
30 #include "chrome/browser/ui/webui/favicon_source.h" 30 #include "chrome/browser/ui/webui/favicon_source.h"
31 #include "chrome/common/chrome_notification_types.h" 31 #include "chrome/common/chrome_notification_types.h"
32 #include "chrome/common/time_format.h" 32 #include "chrome/common/time_format.h"
33 #include "chrome/common/url_constants.h" 33 #include "chrome/common/url_constants.h"
34 #include "content/public/browser/notification_details.h" 34 #include "content/public/browser/notification_details.h"
35 #include "content/public/browser/notification_source.h" 35 #include "content/public/browser/notification_source.h"
36 #include "content/public/browser/user_metrics.h" 36 #include "content/public/browser/user_metrics.h"
37 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 base::Unretained(this))); 279 base::Unretained(this)));
280 } 280 }
281 281
282 void BrowsingHistoryHandler::HandleClearBrowsingData(const ListValue* args) { 282 void BrowsingHistoryHandler::HandleClearBrowsingData(const ListValue* args) {
283 #if defined(OS_ANDROID) 283 #if defined(OS_ANDROID)
284 NOTIMPLEMENTED() << "TODO(yfriedman): Upstream the Android version."; 284 NOTIMPLEMENTED() << "TODO(yfriedman): Upstream the Android version.";
285 #else 285 #else
286 // TODO(beng): This is an improper direct dependency on Browser. Route this 286 // TODO(beng): This is an improper direct dependency on Browser. Route this
287 // through some sort of delegate. 287 // through some sort of delegate.
288 Profile* profile = Profile::FromWebUI(web_ui()); 288 Profile* profile = Profile::FromWebUI(web_ui());
289 Browser* browser = BrowserList::FindBrowserWithProfile(profile); 289 Browser* browser = browser::FindBrowserWithProfile(profile);
290 if (browser) 290 if (browser)
291 browser->OpenClearBrowsingDataDialog(); 291 browser->OpenClearBrowsingDataDialog();
292 #endif 292 #endif
293 } 293 }
294 294
295 void BrowsingHistoryHandler::HandleRemoveBookmark(const ListValue* args) { 295 void BrowsingHistoryHandler::HandleRemoveBookmark(const ListValue* args) {
296 string16 url = ExtractStringValue(args); 296 string16 url = ExtractStringValue(args);
297 Profile* profile = Profile::FromWebUI(web_ui()); 297 Profile* profile = Profile::FromWebUI(web_ui());
298 BookmarkModel* model = profile->GetBookmarkModel(); 298 BookmarkModel* model = profile->GetBookmarkModel();
299 bookmark_utils::RemoveAllBookmarks(model, GURL(url)); 299 bookmark_utils::RemoveAllBookmarks(model, GURL(url));
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 const GURL HistoryUI::GetHistoryURLWithSearchText(const string16& text) { 480 const GURL HistoryUI::GetHistoryURLWithSearchText(const string16& text) {
481 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + 481 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" +
482 net::EscapeQueryParamValue(UTF16ToUTF8(text), true)); 482 net::EscapeQueryParamValue(UTF16ToUTF8(text), true));
483 } 483 }
484 484
485 // static 485 // static
486 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes() { 486 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes() {
487 return ResourceBundle::GetSharedInstance(). 487 return ResourceBundle::GetSharedInstance().
488 LoadDataResourceBytes(IDR_HISTORY_FAVICON); 488 LoadDataResourceBytes(IDR_HISTORY_FAVICON);
489 } 489 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698