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

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

Issue 10824123: Removing instances of profile_->GetBookmarkModel() as part of converting BookmarkModel to a PKS. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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/metrics/metrics_service.cc ('k') | no next file » | 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) 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_model_factory.h"
22 #include "chrome/browser/bookmarks/bookmark_utils.h" 23 #include "chrome/browser/bookmarks/bookmark_utils.h"
23 #include "chrome/browser/history/history_notifications.h" 24 #include "chrome/browser/history/history_notifications.h"
24 #include "chrome/browser/history/history_service_factory.h" 25 #include "chrome/browser/history/history_service_factory.h"
25 #include "chrome/browser/history/history_types.h" 26 #include "chrome/browser/history/history_types.h"
26 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/ui/browser.h" 28 #include "chrome/browser/ui/browser.h"
28 #include "chrome/browser/ui/browser_finder.h" 29 #include "chrome/browser/ui/browser_finder.h"
29 #include "chrome/browser/ui/chrome_pages.h" 30 #include "chrome/browser/ui/chrome_pages.h"
30 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 31 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
31 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" 32 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 // through some sort of delegate. 299 // through some sort of delegate.
299 Browser* browser = browser::FindBrowserWithWebContents( 300 Browser* browser = browser::FindBrowserWithWebContents(
300 web_ui()->GetWebContents()); 301 web_ui()->GetWebContents());
301 chrome::ShowClearBrowsingDataDialog(browser); 302 chrome::ShowClearBrowsingDataDialog(browser);
302 #endif 303 #endif
303 } 304 }
304 305
305 void BrowsingHistoryHandler::HandleRemoveBookmark(const ListValue* args) { 306 void BrowsingHistoryHandler::HandleRemoveBookmark(const ListValue* args) {
306 string16 url = ExtractStringValue(args); 307 string16 url = ExtractStringValue(args);
307 Profile* profile = Profile::FromWebUI(web_ui()); 308 Profile* profile = Profile::FromWebUI(web_ui());
308 BookmarkModel* model = profile->GetBookmarkModel(); 309 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile);
309 bookmark_utils::RemoveAllBookmarks(model, GURL(url)); 310 bookmark_utils::RemoveAllBookmarks(model, GURL(url));
310 } 311 }
311 312
312 void BrowsingHistoryHandler::QueryComplete( 313 void BrowsingHistoryHandler::QueryComplete(
313 HistoryService::Handle request_handle, 314 HistoryService::Handle request_handle,
314 history::QueryResults* results) { 315 history::QueryResults* results) {
315 316
316 ListValue results_value; 317 ListValue results_value;
317 base::Time midnight_today = base::Time::Now().LocalMidnight(); 318 base::Time midnight_today = base::Time::Now().LocalMidnight();
318 319
(...skipping 27 matching lines...) Expand all
346 page_value->SetString("dateRelativeDay", date_str); 347 page_value->SetString("dateRelativeDay", date_str);
347 page_value->SetString("dateTimeOfDay", 348 page_value->SetString("dateTimeOfDay",
348 base::TimeFormatTimeOfDay(page.visit_time())); 349 base::TimeFormatTimeOfDay(page.visit_time()));
349 } else { 350 } else {
350 page_value->SetString("dateShort", 351 page_value->SetString("dateShort",
351 base::TimeFormatShortDate(page.visit_time())); 352 base::TimeFormatShortDate(page.visit_time()));
352 page_value->SetString("snippet", page.snippet().text()); 353 page_value->SetString("snippet", page.snippet().text());
353 } 354 }
354 Profile* profile = Profile::FromWebUI(web_ui()); 355 Profile* profile = Profile::FromWebUI(web_ui());
355 page_value->SetBoolean("starred", 356 page_value->SetBoolean("starred",
356 profile->GetBookmarkModel()->IsBookmarked(page.url())); 357 BookmarkModelFactory::GetForProfile(profile)->IsBookmarked(
358 page.url()));
357 results_value.Append(page_value); 359 results_value.Append(page_value);
358 } 360 }
359 361
360 DictionaryValue info_value; 362 DictionaryValue info_value;
361 info_value.SetString("term", search_text_); 363 info_value.SetString("term", search_text_);
362 info_value.SetBoolean("finished", results->reached_beginning()); 364 info_value.SetBoolean("finished", results->reached_beginning());
363 365
364 web_ui()->CallJavascriptFunction("historyResult", info_value, results_value); 366 web_ui()->CallJavascriptFunction("historyResult", info_value, results_value);
365 } 367 }
366 368
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + 493 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" +
492 net::EscapeQueryParamValue(UTF16ToUTF8(text), true)); 494 net::EscapeQueryParamValue(UTF16ToUTF8(text), true));
493 } 495 }
494 496
495 // static 497 // static
496 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes() { 498 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes() {
497 return ResourceBundle::GetSharedInstance(). 499 return ResourceBundle::GetSharedInstance().
498 LoadDataResourceBytes(IDR_HISTORY_FAVICON, 500 LoadDataResourceBytes(IDR_HISTORY_FAVICON,
499 ui::SCALE_FACTOR_100P); 501 ui::SCALE_FACTOR_100P);
500 } 502 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/metrics_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698