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

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

Issue 7670041: Add --use-more-webui runtime flag to toggle WebUI replacements for native dialogs. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merge with trunk. Created 9 years, 3 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) 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"
11 #include "base/stringprintf.h"
12 #include "chrome/browser/bookmarks/bookmark_editor.h"
13 #include "chrome/browser/bookmarks/bookmark_model.h"
10 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_list.h"
11 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 17 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
12 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
13 #include "content/browser/browser_thread.h" 19 #include "content/browser/browser_thread.h"
14 #include "content/browser/tab_contents/tab_contents.h" 20 #include "content/browser/tab_contents/tab_contents.h"
15 #include "grit/theme_resources.h" 21 #include "grit/theme_resources.h"
16 #include "grit/theme_resources_standard.h" 22 #include "grit/theme_resources_standard.h"
17 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
24 #include "googleurl/src/gurl.h"
25
18 26
19 //////////////////////////////////////////////////////////////////////////////// 27 ////////////////////////////////////////////////////////////////////////////////
20 // 28 //
21 // BookmarksUIHTMLSource 29 // BookmarksUIHTMLSource
22 // 30 //
23 //////////////////////////////////////////////////////////////////////////////// 31 ////////////////////////////////////////////////////////////////////////////////
24 32
25 BookmarksUIHTMLSource::BookmarksUIHTMLSource() 33 BookmarksUIHTMLSource::BookmarksUIHTMLSource()
26 : DataSource(chrome::kChromeUIBookmarksHost, MessageLoop::current()) { 34 : DataSource(chrome::kChromeUIBookmarksHost, MessageLoop::current()) {
27 } 35 }
(...skipping 25 matching lines...) Expand all
53 // Set up the chrome://bookmarks/ source. 61 // Set up the chrome://bookmarks/ source.
54 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); 62 Profile* profile = Profile::FromBrowserContext(contents->browser_context());
55 profile->GetChromeURLDataManager()->AddDataSource(html_source); 63 profile->GetChromeURLDataManager()->AddDataSource(html_source);
56 } 64 }
57 65
58 // static 66 // static
59 RefCountedMemory* BookmarksUI::GetFaviconResourceBytes() { 67 RefCountedMemory* BookmarksUI::GetFaviconResourceBytes() {
60 return ResourceBundle::GetSharedInstance(). 68 return ResourceBundle::GetSharedInstance().
61 LoadDataResourceBytes(IDR_BOOKMARKS_FAVICON); 69 LoadDataResourceBytes(IDR_BOOKMARKS_FAVICON);
62 } 70 }
71
72 ////////////////////////////////////////////////////////////////////////////////
73 //
74 // BookmarkEditor
75 //
76 ////////////////////////////////////////////////////////////////////////////////
77
78 // static
79 void BookmarkEditor::ShowWebUI(Profile* profile,
80 const EditDetails& details) {
81 GURL url(chrome::kChromeUIBookmarksURL);
82 if (details.type == EditDetails::EXISTING_NODE) {
83 DCHECK(details.existing_node);
84 url = url.Resolve(StringPrintf("/#e=%s",
85 base::Int64ToString(details.existing_node->id()).c_str()));
86 } else if (details.type == EditDetails::NEW_URL) {
87 DCHECK(details.parent_node);
88 url = url.Resolve(StringPrintf("/#a=%s",
89 base::Int64ToString(details.parent_node->id()).c_str()));
90 } else {
91 NOTREACHED() << "Unhandled bookmark edit details type";
92 }
93 // Get parent browser object.
94 Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
95 DCHECK(browser);
96 browser::NavigateParams params(
97 browser->GetSingletonTabNavigateParams(url));
98 params.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE;
99 browser->ShowSingletonTabOverwritingNTP(params);
100 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/hung_renderer_view.cc ('k') | chrome/browser/ui/webui/certificate_viewer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698