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

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

Issue 10701030: Refactor SyncedWindowDelegateAndroid into TabModel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Made some changes from a downstream review Created 8 years, 5 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"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "grit/chromium_strings.h" 42 #include "grit/chromium_strings.h"
43 #include "grit/generated_resources.h" 43 #include "grit/generated_resources.h"
44 #include "grit/locale_settings.h" 44 #include "grit/locale_settings.h"
45 #include "grit/theme_resources.h" 45 #include "grit/theme_resources.h"
46 #include "grit/theme_resources_standard.h" 46 #include "grit/theme_resources_standard.h"
47 #include "net/base/escape.h" 47 #include "net/base/escape.h"
48 #include "ui/base/l10n/l10n_util.h" 48 #include "ui/base/l10n/l10n_util.h"
49 #include "ui/base/layout.h" 49 #include "ui/base/layout.h"
50 #include "ui/base/resource/resource_bundle.h" 50 #include "ui/base/resource/resource_bundle.h"
51 51
52 #if defined(OS_ANDROID)
53 #include "chrome/browser/ui/android/tab_model/tab_model_android.h"
54 #include "chrome/browser/ui/android/tab_model/tab_model_list_android.h"
55 #endif
56
52 using content::UserMetricsAction; 57 using content::UserMetricsAction;
53 using content::WebContents; 58 using content::WebContents;
54 59
55 // Maximum number of search results to return in a given search. We should 60 // Maximum number of search results to return in a given search. We should
56 // eventually remove this. 61 // eventually remove this.
57 static const int kMaxSearchResults = 100; 62 static const int kMaxSearchResults = 100;
58 static const char kStringsJsFile[] = "strings.js"; 63 static const char kStringsJsFile[] = "strings.js";
59 static const char kHistoryJsFile[] = "history.js"; 64 static const char kHistoryJsFile[] = "history.js";
60 65
61 namespace { 66 namespace {
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 280
276 HistoryService* hs = 281 HistoryService* hs =
277 Profile::FromWebUI(web_ui())->GetHistoryService(Profile::EXPLICIT_ACCESS); 282 Profile::FromWebUI(web_ui())->GetHistoryService(Profile::EXPLICIT_ACCESS);
278 hs->ExpireHistoryBetween( 283 hs->ExpireHistoryBetween(
279 urls_to_be_deleted_, begin_time, end_time, &cancelable_delete_consumer_, 284 urls_to_be_deleted_, begin_time, end_time, &cancelable_delete_consumer_,
280 base::Bind(&BrowsingHistoryHandler::RemoveComplete, 285 base::Bind(&BrowsingHistoryHandler::RemoveComplete,
281 base::Unretained(this))); 286 base::Unretained(this)));
282 } 287 }
283 288
284 void BrowsingHistoryHandler::HandleClearBrowsingData(const ListValue* args) { 289 void BrowsingHistoryHandler::HandleClearBrowsingData(const ListValue* args) {
290 Profile* profile = Profile::FromWebUI(web_ui());
285 #if defined(OS_ANDROID) 291 #if defined(OS_ANDROID)
286 NOTIMPLEMENTED() << "TODO(yfriedman): Upstream the Android version."; 292 const TabModelAndroid* tab_model =
293 TabModelListAndroid::GetTabModelWithProfile(profile);
294 if (tab_model)
295 tab_model->OpenClearBrowsingData();
287 #else 296 #else
288 // TODO(beng): This is an improper direct dependency on Browser. Route this 297 // TODO(beng): This is an improper direct dependency on Browser. Route this
289 // through some sort of delegate. 298 // through some sort of delegate.
290 Profile* profile = Profile::FromWebUI(web_ui());
291 Browser* browser = browser::FindBrowserWithProfile(profile); 299 Browser* browser = browser::FindBrowserWithProfile(profile);
292 if (browser) 300 if (browser)
293 chrome::ShowClearBrowsingDataDialog(browser); 301 chrome::ShowClearBrowsingDataDialog(browser);
294 #endif 302 #endif
295 } 303 }
296 304
297 void BrowsingHistoryHandler::HandleRemoveBookmark(const ListValue* args) { 305 void BrowsingHistoryHandler::HandleRemoveBookmark(const ListValue* args) {
298 string16 url = ExtractStringValue(args); 306 string16 url = ExtractStringValue(args);
299 Profile* profile = Profile::FromWebUI(web_ui()); 307 Profile* profile = Profile::FromWebUI(web_ui());
300 BookmarkModel* model = profile->GetBookmarkModel(); 308 BookmarkModel* model = profile->GetBookmarkModel();
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + 491 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" +
484 net::EscapeQueryParamValue(UTF16ToUTF8(text), true)); 492 net::EscapeQueryParamValue(UTF16ToUTF8(text), true));
485 } 493 }
486 494
487 // static 495 // static
488 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes() { 496 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes() {
489 return ResourceBundle::GetSharedInstance(). 497 return ResourceBundle::GetSharedInstance().
490 LoadDataResourceBytes(IDR_HISTORY_FAVICON, 498 LoadDataResourceBytes(IDR_HISTORY_FAVICON,
491 ui::SCALE_FACTOR_100P); 499 ui::SCALE_FACTOR_100P);
492 } 500 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698