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

Unified Diff: chrome/browser/ui/webui/bookmarks_ui.cc

Issue 7957002: Reland add --use-more-webui runtime flag to toggle WebUI replacements for native dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/bookmarks_ui.cc
diff --git a/chrome/browser/ui/webui/bookmarks_ui.cc b/chrome/browser/ui/webui/bookmarks_ui.cc
index 6c78bcc597462a8b46e13029590bfd743243a8bf..d5ec1a43a53d6bcb985c9b77c716b5c25446273b 100644
--- a/chrome/browser/ui/webui/bookmarks_ui.cc
+++ b/chrome/browser/ui/webui/bookmarks_ui.cc
@@ -7,7 +7,13 @@
#include "base/memory/ref_counted_memory.h"
#include "base/memory/singleton.h"
#include "base/message_loop.h"
+#include "base/string_number_conversions.h"
+#include "base/stringprintf.h"
+#include "chrome/browser/bookmarks/bookmark_editor.h"
+#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/common/url_constants.h"
#include "content/browser/browser_thread.h"
@@ -15,6 +21,8 @@
#include "grit/theme_resources.h"
#include "grit/theme_resources_standard.h"
#include "ui/base/resource/resource_bundle.h"
+#include "googleurl/src/gurl.h"
+
////////////////////////////////////////////////////////////////////////////////
//
@@ -60,3 +68,33 @@ RefCountedMemory* BookmarksUI::GetFaviconResourceBytes() {
return ResourceBundle::GetSharedInstance().
LoadDataResourceBytes(IDR_BOOKMARKS_FAVICON);
}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// BookmarkEditor
+//
+////////////////////////////////////////////////////////////////////////////////
+
+// static
+void BookmarkEditor::ShowWebUI(Profile* profile,
+ const EditDetails& details) {
+ GURL url(chrome::kChromeUIBookmarksURL);
+ if (details.type == EditDetails::EXISTING_NODE) {
+ DCHECK(details.existing_node);
+ url = url.Resolve(StringPrintf("/#e=%s",
+ base::Int64ToString(details.existing_node->id()).c_str()));
+ } else if (details.type == EditDetails::NEW_URL) {
+ DCHECK(details.parent_node);
+ url = url.Resolve(StringPrintf("/#a=%s",
+ base::Int64ToString(details.parent_node->id()).c_str()));
+ } else {
+ NOTREACHED() << "Unhandled bookmark edit details type";
+ }
+ // Get parent browser object.
+ Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
+ DCHECK(browser);
+ browser::NavigateParams params(
+ browser->GetSingletonTabNavigateParams(url));
+ params.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE;
+ browser->ShowSingletonTabOverwritingNTP(params);
+}
« 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