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

Side by Side Diff: chrome/browser/ui/webui/bookmarks_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/bookmarks_ui.h ('k') | chrome/browser/ui/webui/bug_report_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/bookmarks_ui.h" 5 #include "chrome/browser/ui/webui/bookmarks_ui.h"
6 6
7 #include "base/memory/ref_counted_memory.h" 7 #include "base/memory/ref_counted_memory.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "base/stringprintf.h" 11 #include "base/stringprintf.h"
12 #include "chrome/browser/bookmarks/bookmark_editor.h" 12 #include "chrome/browser/bookmarks/bookmark_editor.h"
13 #include "chrome/browser/bookmarks/bookmark_model.h" 13 #include "chrome/browser/bookmarks/bookmark_model.h"
14 #include "chrome/browser/bookmarks/bookmark_utils.h" 14 #include "chrome/browser/bookmarks/bookmark_utils.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_list.h" 17 #include "chrome/browser/ui/browser_list.h"
18 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 18 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
19 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
20 #include "content/browser/tab_contents/tab_contents.h" 20 #include "content/public/browser/web_contents.h"
21 #include "grit/theme_resources.h" 21 #include "grit/theme_resources.h"
22 #include "grit/theme_resources_standard.h" 22 #include "grit/theme_resources_standard.h"
23 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
24 #include "googleurl/src/gurl.h" 24 #include "googleurl/src/gurl.h"
25 25
26 using content::WebContents;
26 27
27 //////////////////////////////////////////////////////////////////////////////// 28 ////////////////////////////////////////////////////////////////////////////////
28 // 29 //
29 // BookmarksUIHTMLSource 30 // BookmarksUIHTMLSource
30 // 31 //
31 //////////////////////////////////////////////////////////////////////////////// 32 ////////////////////////////////////////////////////////////////////////////////
32 33
33 BookmarksUIHTMLSource::BookmarksUIHTMLSource() 34 BookmarksUIHTMLSource::BookmarksUIHTMLSource()
34 : DataSource(chrome::kChromeUIBookmarksHost, MessageLoop::current()) { 35 : DataSource(chrome::kChromeUIBookmarksHost, MessageLoop::current()) {
35 } 36 }
(...skipping 12 matching lines...) Expand all
48 << "been triggered"; 49 << "been triggered";
49 return "text/html"; 50 return "text/html";
50 } 51 }
51 52
52 //////////////////////////////////////////////////////////////////////////////// 53 ////////////////////////////////////////////////////////////////////////////////
53 // 54 //
54 // BookmarksUI 55 // BookmarksUI
55 // 56 //
56 //////////////////////////////////////////////////////////////////////////////// 57 ////////////////////////////////////////////////////////////////////////////////
57 58
58 BookmarksUI::BookmarksUI(TabContents* contents) : ChromeWebUI(contents) { 59 BookmarksUI::BookmarksUI(WebContents* contents) : ChromeWebUI(contents) {
59 BookmarksUIHTMLSource* html_source = new BookmarksUIHTMLSource(); 60 BookmarksUIHTMLSource* html_source = new BookmarksUIHTMLSource();
60 61
61 // Set up the chrome://bookmarks/ source. 62 // Set up the chrome://bookmarks/ source.
62 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); 63 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
63 profile->GetChromeURLDataManager()->AddDataSource(html_source); 64 profile->GetChromeURLDataManager()->AddDataSource(html_source);
64 } 65 }
65 66
66 // static 67 // static
67 RefCountedMemory* BookmarksUI::GetFaviconResourceBytes() { 68 RefCountedMemory* BookmarksUI::GetFaviconResourceBytes() {
68 return ResourceBundle::GetSharedInstance(). 69 return ResourceBundle::GetSharedInstance().
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 base::Int64ToString(editId).c_str())); 106 base::Int64ToString(editId).c_str()));
106 107
107 // Invoke the WebUI bookmark editor to edit the specified bookmark. 108 // Invoke the WebUI bookmark editor to edit the specified bookmark.
108 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); 109 Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
109 DCHECK(browser); 110 DCHECK(browser);
110 browser::NavigateParams params( 111 browser::NavigateParams params(
111 browser->GetSingletonTabNavigateParams(url)); 112 browser->GetSingletonTabNavigateParams(url));
112 params.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; 113 params.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE;
113 browser->ShowSingletonTabOverwritingNTP(params); 114 browser->ShowSingletonTabOverwritingNTP(params);
114 } 115 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/bookmarks_ui.h ('k') | chrome/browser/ui/webui/bug_report_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698