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

Side by Side Diff: chrome/browser/bookmarks/bookmark_editor.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: Created 9 years, 4 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/string_number_conversions.h"
6 #include "base/stringprintf.h"
5 #include "chrome/browser/bookmarks/bookmark_editor.h" 7 #include "chrome/browser/bookmarks/bookmark_editor.h"
8 #include "chrome/browser/bookmarks/bookmark_model.h"
9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_list.h"
11 #include "chrome/browser/ui/webui/chrome_web_ui.h"
12 #include "chrome/common/url_constants.h"
6 13
7 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
8 15
9 BookmarkEditor::EditDetails::EditDetails() 16 // TODO(flackr): Remove this and create runtime flag for webui dialogs
Rick Byers 2011/08/18 19:25:30 I'm confused, I thought creating a runtime flag is
flackr 2011/08/23 17:41:44 Oops that was leftover from when I was using --use
10 : type(NEW_URL), 17 #include "views/widget/widget.h"
11 existing_node(NULL) { 18
19 BookmarkEditor::EditDetails::EditDetails() {
12 } 20 }
13 21
14 BookmarkEditor::EditDetails::EditDetails(const BookmarkNode* node) 22 BookmarkEditor::EditDetails BookmarkEditor::EditDetails::EditNode(
15 : type(EXISTING_NODE), 23 const BookmarkNode* node) {
16 existing_node(node) { 24 EditDetails details;
25 details.type = EXISTING_NODE;
26 details.existing_node = node;
27 return details;
28 }
29
30 BookmarkEditor::EditDetails BookmarkEditor::EditDetails::AddNodeInFolder(
31 const BookmarkNode* parent_node) {
32 EditDetails details;
33 details.type = NEW_URL;
34 details.parent_node = parent_node;
35 return details;
36 }
37
38 BookmarkEditor::EditDetails BookmarkEditor::EditDetails::AddFolder(
39 const BookmarkNode* parent_node) {
40 EditDetails details;
41 details.type = NEW_FOLDER;
42 details.parent_node = parent_node;
43 return details;
17 } 44 }
18 45
19 BookmarkEditor::EditDetails::~EditDetails() { 46 BookmarkEditor::EditDetails::~EditDetails() {
20 } 47 }
48
49 void BookmarkEditor::Show(gfx::NativeWindow parent_window,
50 Profile* profile,
51 const EditDetails& details,
52 Configuration configuration) {
53 if (ChromeWebUI::IsMoreWebUI() && (
Rick Byers 2011/08/18 19:25:30 Minor, but it might be nice to split the WebUI por
flackr 2011/08/23 17:41:44 Done.
54 details.type == EditDetails::EXISTING_NODE ||
Rick Byers 2011/08/18 19:25:30 This is (very) temporary, right? Add a TODO for i
Rick Byers 2011/08/18 19:25:30 Is this indentation level right? Off the top of m
flackr 2011/08/23 17:41:44 Done.
flackr 2011/08/23 17:41:44 Done.
55 details.type == EditDetails::NEW_URL)) {
56 GURL url(chrome::kChromeUIBookmarksURL);
57 if (details.type == EditDetails::EXISTING_NODE) {
58 DCHECK(details.existing_node);
59 url = url.Resolve(StringPrintf("/#e=%s",
60 base::Int64ToString(details.existing_node->id()).c_str()));
61 } else if (details.type == EditDetails::NEW_URL) {
62 DCHECK(details.parent_node);
63 url = url.Resolve(StringPrintf("/#a=%s",
64 base::Int64ToString(details.parent_node->id()).c_str()));
65 } else {
66 NOTREACHED() << "Unhandled bookmark edit details type";
67 }
68 // Get parent browser object.
69 Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
70 DCHECK(browser);
71 browser::NavigateParams params(
72 browser->GetSingletonTabNavigateParams(url));
73 params.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE;
74 browser->ShowSingletonTabOverwritingNTP(params);
75 return;
76 }
77
78 // Delegate to the platform native bookmark editor code.
79 ShowNative(parent_window, profile, details.parent_node, details,
80 configuration);
81 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698