OLD | NEW |
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" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 << "been triggered"; | 49 << "been triggered"; |
50 return "text/html"; | 50 return "text/html"; |
51 } | 51 } |
52 | 52 |
53 //////////////////////////////////////////////////////////////////////////////// | 53 //////////////////////////////////////////////////////////////////////////////// |
54 // | 54 // |
55 // BookmarksUI | 55 // BookmarksUI |
56 // | 56 // |
57 //////////////////////////////////////////////////////////////////////////////// | 57 //////////////////////////////////////////////////////////////////////////////// |
58 | 58 |
59 BookmarksUI::BookmarksUI(WebContents* contents) : WebUI(contents) { | 59 BookmarksUI::BookmarksUI(WebContents* contents) : WebUI(contents, this) { |
60 BookmarksUIHTMLSource* html_source = new BookmarksUIHTMLSource(); | 60 BookmarksUIHTMLSource* html_source = new BookmarksUIHTMLSource(); |
61 | 61 |
62 // Set up the chrome://bookmarks/ source. | 62 // Set up the chrome://bookmarks/ source. |
63 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 63 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
64 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 64 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
65 } | 65 } |
66 | 66 |
67 // static | 67 // static |
68 RefCountedMemory* BookmarksUI::GetFaviconResourceBytes() { | 68 RefCountedMemory* BookmarksUI::GetFaviconResourceBytes() { |
69 return ResourceBundle::GetSharedInstance(). | 69 return ResourceBundle::GetSharedInstance(). |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 base::Int64ToString(editId).c_str())); | 106 base::Int64ToString(editId).c_str())); |
107 | 107 |
108 // Invoke the WebUI bookmark editor to edit the specified bookmark. | 108 // Invoke the WebUI bookmark editor to edit the specified bookmark. |
109 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); | 109 Browser* browser = BrowserList::GetLastActiveWithProfile(profile); |
110 DCHECK(browser); | 110 DCHECK(browser); |
111 browser::NavigateParams params( | 111 browser::NavigateParams params( |
112 browser->GetSingletonTabNavigateParams(url)); | 112 browser->GetSingletonTabNavigateParams(url)); |
113 params.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; | 113 params.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; |
114 browser->ShowSingletonTabOverwritingNTP(params); | 114 browser->ShowSingletonTabOverwritingNTP(params); |
115 } | 115 } |
OLD | NEW |