OLD | NEW |
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 Loading... |
42 #include "grit/browser_resources.h" | 42 #include "grit/browser_resources.h" |
43 #include "grit/chromium_strings.h" | 43 #include "grit/chromium_strings.h" |
44 #include "grit/generated_resources.h" | 44 #include "grit/generated_resources.h" |
45 #include "grit/locale_settings.h" | 45 #include "grit/locale_settings.h" |
46 #include "grit/theme_resources.h" | 46 #include "grit/theme_resources.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.h" |
| 54 #include "chrome/browser/ui/android/tab_model/tab_model_list.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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 HistoryService* hs = HistoryServiceFactory::GetForProfile( | 281 HistoryService* hs = HistoryServiceFactory::GetForProfile( |
277 Profile::FromWebUI(web_ui()), Profile::EXPLICIT_ACCESS); | 282 Profile::FromWebUI(web_ui()), 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) { |
285 #if defined(OS_ANDROID) | 290 #if defined(OS_ANDROID) |
286 NOTIMPLEMENTED() << "TODO(yfriedman): Upstream the Android version."; | 291 Profile* profile = Profile::FromWebUI(web_ui()); |
| 292 const TabModel* tab_model = |
| 293 TabModelList::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 Browser* browser = browser::FindBrowserWithWebContents( | 299 Browser* browser = browser::FindBrowserWithWebContents( |
291 web_ui()->GetWebContents()); | 300 web_ui()->GetWebContents()); |
292 chrome::ShowClearBrowsingDataDialog(browser); | 301 chrome::ShowClearBrowsingDataDialog(browser); |
293 #endif | 302 #endif |
294 } | 303 } |
295 | 304 |
296 void BrowsingHistoryHandler::HandleRemoveBookmark(const ListValue* args) { | 305 void BrowsingHistoryHandler::HandleRemoveBookmark(const ListValue* args) { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + | 491 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + |
483 net::EscapeQueryParamValue(UTF16ToUTF8(text), true)); | 492 net::EscapeQueryParamValue(UTF16ToUTF8(text), true)); |
484 } | 493 } |
485 | 494 |
486 // static | 495 // static |
487 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes() { | 496 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes() { |
488 return ResourceBundle::GetSharedInstance(). | 497 return ResourceBundle::GetSharedInstance(). |
489 LoadDataResourceBytes(IDR_HISTORY_FAVICON, | 498 LoadDataResourceBytes(IDR_HISTORY_FAVICON, |
490 ui::SCALE_FACTOR_100P); | 499 ui::SCALE_FACTOR_100P); |
491 } | 500 } |
OLD | NEW |