| 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);
|
| +}
|
|
|