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

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

Issue 9003014: Replace WebUI::tab_contents() with web_contents() and switch all users to use web_contents.h inst... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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/ui/webui/history_ui.h ('k') | chrome/browser/ui/webui/html_dialog_ui.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 12 matching lines...) Expand all
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_list.h"
28 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" 28 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
29 #include "chrome/browser/ui/webui/favicon_source.h" 29 #include "chrome/browser/ui/webui/favicon_source.h"
30 #include "chrome/common/chrome_notification_types.h" 30 #include "chrome/common/chrome_notification_types.h"
31 #include "chrome/common/time_format.h" 31 #include "chrome/common/time_format.h"
32 #include "chrome/common/url_constants.h" 32 #include "chrome/common/url_constants.h"
33 #include "content/browser/tab_contents/tab_contents.h"
34 #include "content/public/browser/notification_details.h" 33 #include "content/public/browser/notification_details.h"
35 #include "content/public/browser/notification_source.h" 34 #include "content/public/browser/notification_source.h"
36 #include "content/public/browser/user_metrics.h" 35 #include "content/public/browser/user_metrics.h"
36 #include "content/public/browser/web_contents.h"
37 #include "content/public/browser/web_contents_delegate.h" 37 #include "content/public/browser/web_contents_delegate.h"
38 #include "grit/browser_resources.h" 38 #include "grit/browser_resources.h"
39 #include "grit/chromium_strings.h" 39 #include "grit/chromium_strings.h"
40 #include "grit/generated_resources.h" 40 #include "grit/generated_resources.h"
41 #include "grit/locale_settings.h" 41 #include "grit/locale_settings.h"
42 #include "grit/theme_resources.h" 42 #include "grit/theme_resources.h"
43 #include "grit/theme_resources_standard.h" 43 #include "grit/theme_resources_standard.h"
44 #include "net/base/escape.h" 44 #include "net/base/escape.h"
45 #include "ui/base/l10n/l10n_util.h" 45 #include "ui/base/l10n/l10n_util.h"
46 #include "ui/base/resource/resource_bundle.h" 46 #include "ui/base/resource/resource_bundle.h"
47 47
48 using content::UserMetricsAction; 48 using content::UserMetricsAction;
49 using content::WebContents;
49 50
50 // Maximum number of search results to return in a given search. We should 51 // Maximum number of search results to return in a given search. We should
51 // eventually remove this. 52 // eventually remove this.
52 static const int kMaxSearchResults = 100; 53 static const int kMaxSearchResults = 100;
53 static const char kStringsJsFile[] = "strings.js"; 54 static const char kStringsJsFile[] = "strings.js";
54 static const char kHistoryJsFile[] = "history.js"; 55 static const char kHistoryJsFile[] = "history.js";
55 56
56 //////////////////////////////////////////////////////////////////////////////// 57 ////////////////////////////////////////////////////////////////////////////////
57 // 58 //
58 // HistoryUIHTMLSource 59 // HistoryUIHTMLSource
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 web_ui()->CallJavascriptFunction("historyDeleted"); 416 web_ui()->CallJavascriptFunction("historyDeleted");
416 } 417 }
417 } 418 }
418 419
419 //////////////////////////////////////////////////////////////////////////////// 420 ////////////////////////////////////////////////////////////////////////////////
420 // 421 //
421 // HistoryUI 422 // HistoryUI
422 // 423 //
423 //////////////////////////////////////////////////////////////////////////////// 424 ////////////////////////////////////////////////////////////////////////////////
424 425
425 HistoryUI::HistoryUI(TabContents* contents) : ChromeWebUI(contents) { 426 HistoryUI::HistoryUI(WebContents* contents) : ChromeWebUI(contents) {
426 AddMessageHandler(new BrowsingHistoryHandler()); 427 AddMessageHandler(new BrowsingHistoryHandler());
427 428
428 HistoryUIHTMLSource* html_source = new HistoryUIHTMLSource(); 429 HistoryUIHTMLSource* html_source = new HistoryUIHTMLSource();
429 430
430 // Set up the chrome://history/ source. 431 // Set up the chrome://history/ source.
431 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); 432 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
432 profile->GetChromeURLDataManager()->AddDataSource(html_source); 433 profile->GetChromeURLDataManager()->AddDataSource(html_source);
433 } 434 }
434 435
435 // static 436 // static
436 const GURL HistoryUI::GetHistoryURLWithSearchText(const string16& text) { 437 const GURL HistoryUI::GetHistoryURLWithSearchText(const string16& text) {
437 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + 438 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" +
438 net::EscapeQueryParamValue(UTF16ToUTF8(text), true)); 439 net::EscapeQueryParamValue(UTF16ToUTF8(text), true));
439 } 440 }
440 441
441 // static 442 // static
442 RefCountedMemory* HistoryUI::GetFaviconResourceBytes() { 443 RefCountedMemory* HistoryUI::GetFaviconResourceBytes() {
443 return ResourceBundle::GetSharedInstance(). 444 return ResourceBundle::GetSharedInstance().
444 LoadDataResourceBytes(IDR_HISTORY_FAVICON); 445 LoadDataResourceBytes(IDR_HISTORY_FAVICON);
445 } 446 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/history_ui.h ('k') | chrome/browser/ui/webui/html_dialog_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698