summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/common.gypi16
-rw-r--r--chrome/browser/bookmarks/bookmark_context_menu_controller.cc23
-rw-r--r--chrome/browser/bookmarks/bookmark_editor.cc48
-rw-r--r--chrome/browser/bookmarks/bookmark_editor.h44
-rw-r--r--chrome/browser/browser_resources.grd2
-rw-r--r--chrome/browser/certificate_viewer.h7
-rw-r--r--chrome/browser/sync/test/integration/bookmarks_helper.cc4
-rw-r--r--chrome/browser/ui/browser.cc7
-rw-r--r--chrome/browser/ui/browser_dialogs.h4
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm19
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.mm10
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.mm5
-rw-r--r--chrome/browser/ui/cocoa/hung_renderer_controller.mm4
-rw-r--r--chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc12
-rw-r--r--chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc10
-rw-r--r--chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk_unittest.cc18
-rw-r--r--chrome/browser/ui/gtk/certificate_viewer.cc14
-rw-r--r--chrome/browser/ui/gtk/certificate_viewer.h16
-rw-r--r--chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc4
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc16
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc19
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc10
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_editor_view_unittest.cc35
-rw-r--r--chrome/browser/ui/views/hung_renderer_view.cc4
-rw-r--r--chrome/browser/ui/webui/bookmarks_ui.cc38
-rw-r--r--chrome/browser/ui/webui/certificate_viewer.cc16
-rw-r--r--chrome/browser/ui/webui/certificate_viewer.h3
-rw-r--r--chrome/browser/ui/webui/chrome_web_ui.cc16
-rw-r--r--chrome/browser/ui/webui/chrome_web_ui.h4
-rw-r--r--chrome/browser/ui/webui/chrome_web_ui_factory.cc11
-rw-r--r--chrome/browser/ui/webui/html_dialog_ui.cc8
-rw-r--r--chrome/browser/ui/webui/html_dialog_ui.h3
-rw-r--r--chrome/browser/ui/webui/hung_renderer_dialog.cc32
-rw-r--r--chrome/browser/ui/webui/hung_renderer_dialog.h6
-rw-r--r--chrome/chrome_browser.gypi39
-rw-r--r--chrome/common/chrome_switches.cc4
-rw-r--r--chrome/common/chrome_switches.h1
37 files changed, 237 insertions, 295 deletions
diff --git a/build/common.gypi b/build/common.gypi
index 0134fd5..f060eb5 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -34,6 +34,11 @@
# Disable touch support by default.
'touchui%': 0,
+ # Disable webui dialog replacements for native dialogs by default.
+ # TODO(flackr): Change this to a runtime flag triggered by
+ # --pure-views so that these dialogs can be easily tested.
+ 'webui_dialogs%': 0,
+
# Whether the compositor is enabled on views.
'views_compositor%': 0,
@@ -44,6 +49,7 @@
'chromeos%': '<(chromeos)',
'use_only_pure_views%': '<(use_only_pure_views)',
'touchui%': '<(touchui)',
+ 'webui_dialogs%': '<(webui_dialogs)',
'views_compositor%': '<(views_compositor)',
'use_aura%': '<(use_aura)',
@@ -74,6 +80,11 @@
'use_only_pure_views%': 0,
}],
+ # Use WebUI dialogs in TouchUI and PureView builds.
+ ['touchui==1 or use_only_pure_views==1 or use_aura==1', {
+ 'webui_dialogs%': 1,
+ }],
+
# Use the views compositor when using the Aura window manager.
['use_aura==1', {
'views_compositor%': 1,
@@ -84,6 +95,7 @@
# Copy conditionally-set variables out one scope.
'chromeos%': '<(chromeos)',
'touchui%': '<(touchui)',
+ 'webui_dialogs%': '<(webui_dialogs)',
'host_arch%': '<(host_arch)',
'toolkit_views%': '<(toolkit_views)',
'use_only_pure_views%': '<(use_only_pure_views)',
@@ -296,6 +308,7 @@
'enable_flapper_hacks%': '<(enable_flapper_hacks)',
'chromeos%': '<(chromeos)',
'touchui%': '<(touchui)',
+ 'webui_dialogs%': '<(webui_dialogs)',
'file_manager_extension%': '<(file_manager_extension)',
'webui_task_manager%': '<(webui_task_manager)',
'inside_chromium_build%': '<(inside_chromium_build)',
@@ -658,6 +671,9 @@
['touchui==1', {
'grit_defines': ['-D', 'touchui'],
}],
+ ['webui_dialogs==1', {
+ 'grit_defines': ['-D', 'webui_dialogs'],
+ }],
['file_manager_extension==1', {
'grit_defines': ['-D', 'file_manager_extension'],
}],
diff --git a/chrome/browser/bookmarks/bookmark_context_menu_controller.cc b/chrome/browser/bookmarks/bookmark_context_menu_controller.cc
index 97cfb92..0e92c12 100644
--- a/chrome/browser/bookmarks/bookmark_context_menu_controller.cc
+++ b/chrome/browser/bookmarks/bookmark_context_menu_controller.cc
@@ -139,9 +139,15 @@ void BookmarkContextMenuController::ExecuteCommand(int id) {
}
if (selection_[0]->is_url()) {
- BookmarkEditor::Show(parent_window_, profile_,
- BookmarkEditor::EditDetails::EditNode(selection_[0]),
- BookmarkEditor::SHOW_TREE);
+#if defined(WEBUI_DIALOGS)
+ Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ DCHECK(browser);
+ browser->OpenBookmarkManagerEditNode(selection_[0]->id());
+#else
+ BookmarkEditor::Show(parent_window_, profile_, parent_,
+ BookmarkEditor::EditDetails(selection_[0]),
+ BookmarkEditor::SHOW_TREE);
+#endif
} else {
BookmarkFolderEditorController::Show(profile_, parent_window_,
selection_[0], -1,
@@ -166,12 +172,17 @@ void BookmarkContextMenuController::ExecuteCommand(int id) {
UserMetrics::RecordAction(
UserMetricsAction("BookmarkBar_ContextMenu_Add"));
+#if defined(WEBUI_DIALOGS)
+ Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ DCHECK(browser);
+ browser->OpenBookmarkManagerAddNodeIn(selection_[0]->id());
+#else
// TODO: this should honor the index from GetParentForNewNodes.
BookmarkEditor::Show(
parent_window_, profile_,
- BookmarkEditor::EditDetails::AddNodeInFolder(
- bookmark_utils::GetParentForNewNodes(parent_, selection_, NULL)),
- BookmarkEditor::SHOW_TREE);
+ bookmark_utils::GetParentForNewNodes(parent_, selection_, NULL),
+ BookmarkEditor::EditDetails(), BookmarkEditor::SHOW_TREE);
+#endif
break;
}
diff --git a/chrome/browser/bookmarks/bookmark_editor.cc b/chrome/browser/bookmarks/bookmark_editor.cc
index 521f441..2e940fc 100644
--- a/chrome/browser/bookmarks/bookmark_editor.cc
+++ b/chrome/browser/bookmarks/bookmark_editor.cc
@@ -1,52 +1,20 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/bookmarks/bookmark_editor.h"
-#include "chrome/browser/bookmarks/bookmark_model.h"
-#include "chrome/browser/ui/webui/chrome_web_ui.h"
-BookmarkEditor::EditDetails::EditDetails(Type node_type)
- : type(node_type) {
-}
-
-BookmarkEditor::EditDetails BookmarkEditor::EditDetails::EditNode(
- const BookmarkNode* node) {
- EditDetails details(EXISTING_NODE);
- details.existing_node = node;
- return details;
-}
+#include "googleurl/src/gurl.h"
-BookmarkEditor::EditDetails BookmarkEditor::EditDetails::AddNodeInFolder(
- const BookmarkNode* parent_node) {
- EditDetails details(NEW_URL);
- details.parent_node = parent_node;
- return details;
+BookmarkEditor::EditDetails::EditDetails()
+ : type(NEW_URL),
+ existing_node(NULL) {
}
-BookmarkEditor::EditDetails BookmarkEditor::EditDetails::AddFolder(
- const BookmarkNode* parent_node) {
- EditDetails details(NEW_FOLDER);
- details.parent_node = parent_node;
- return details;
+BookmarkEditor::EditDetails::EditDetails(const BookmarkNode* node)
+ : type(EXISTING_NODE),
+ existing_node(node) {
}
BookmarkEditor::EditDetails::~EditDetails() {
}
-
-void BookmarkEditor::Show(gfx::NativeWindow parent_window,
- Profile* profile,
- const EditDetails& details,
- Configuration configuration) {
- // TODO(flackr): Implement NEW_FOLDER type in WebUI and remove the type check.
- if (ChromeWebUI::IsMoreWebUI() && (
- details.type == EditDetails::EXISTING_NODE ||
- details.type == EditDetails::NEW_URL)) {
- ShowWebUI(profile, details);
- return;
- }
-
- // Delegate to the platform native bookmark editor code.
- ShowNative(parent_window, profile, details.parent_node, details,
- configuration);
-}
diff --git a/chrome/browser/bookmarks/bookmark_editor.h b/chrome/browser/bookmarks/bookmark_editor.h
index 5b3a6ab..39e99ea 100644
--- a/chrome/browser/bookmarks/bookmark_editor.h
+++ b/chrome/browser/bookmarks/bookmark_editor.h
@@ -27,19 +27,7 @@ class BookmarkEditor {
};
// Describes what the user is editing.
- class EditDetails {
- public:
- // Returns an EditDetails instance for the user editing the given bookmark.
- static EditDetails EditNode(const BookmarkNode* node);
-
- // Returns an EditDetails instance for the user adding a bookmark within
- // a given parent node.
- static EditDetails AddNodeInFolder(const BookmarkNode* parent_node);
-
- // Returns an EditDetails instance for the user adding a folder within a
- // given parent node.
- static EditDetails AddFolder(const BookmarkNode* parent_node);
-
+ struct EditDetails {
enum Type {
// The user is editing an existing node in the model. The node the user
// is editing is set in |existing_node|.
@@ -55,50 +43,34 @@ class BookmarkEditor {
NEW_FOLDER
};
+ EditDetails();
+ explicit EditDetails(const BookmarkNode* node);
~EditDetails();
// See description of enum value for details.
- const Type type;
+ Type type;
// If type == EXISTING_NODE this gives the existing node.
const BookmarkNode* existing_node;
- // If type == NEW_URL or type == NEW_FOLDER this gives the parent node
- // to place the new node in.
- const BookmarkNode* parent_node;
-
// If type == NEW_FOLDER, this is the urls/title pairs to add to the
// folder.
std::vector<std::pair<GURL, string16> > urls;
-
- private:
- explicit EditDetails(Type node_type);
};
- // Shows the bookmark editor. If --use-more-webui is enabled use the bookmark
- // manager to add or edit bookmarks. The bookmark editor allows editing an
+ // Shows the bookmark editor. The bookmark editor allows editing an
// existing node or creating a new bookmark node (as determined by
// |details.type|). If |configuration| is SHOW_TREE, a tree is shown allowing
// the user to choose the parent of the node.
// |parent| gives the initial parent to select in the tree for the node.
// |parent| is only used if |details.existing_node| is null.
+ // TODO(flackr): Rename this to ShowNative and add cross platform Show method
+ // which will show a WebUI version of the dialog if --pure-views is set.
static void Show(gfx::NativeWindow parent_window,
Profile* profile,
+ const BookmarkNode* parent,
const EditDetails& details,
Configuration configuration);
-
- private:
- // Shows the native bookmark editor.
- // TODO(flackr): Remove parent argument.
- static void ShowNative(gfx::NativeWindow parent_window,
- Profile* profile,
- const BookmarkNode* parent,
- const EditDetails& details,
- Configuration configuration);
-
- // Shows the WebUI bookmark editor.
- static void ShowWebUI(Profile* profile,
- const EditDetails& details);
};
#endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_EDITOR_H_
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd
index 280b48c..d768df4 100644
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -30,7 +30,7 @@
<include name="IDR_ABOUT_VERSION_HTML" file="resources\about_version.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
<include name="IDR_ABOUT_VERSION_JS" file="resources\about_version.js" type="BINDATA" />
<include name="IDR_BOOKMARKS_MANIFEST" file="resources\bookmark_manager\manifest.json" type="BINDATA" />
- <if expr="is_posix and not is_macosx">
+ <if expr="pp_if('webui_dialogs')">
<include name="IDR_CERTIFICATE_VIEWER_HTML" file="resources\certificate_viewer.html" type="BINDATA" />
<include name="IDR_CERTIFICATE_VIEWER_JS" file="resources\certificate_viewer.js" type="BINDATA" />
<include name="IDR_CERTIFICATE_VIEWER_CSS" file="resources\certificate_viewer.css" type="BINDATA" />
diff --git a/chrome/browser/certificate_viewer.h b/chrome/browser/certificate_viewer.h
index 2dc9bbc..89b0e04 100644
--- a/chrome/browser/certificate_viewer.h
+++ b/chrome/browser/certificate_viewer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,9 +22,4 @@ void ShowCertificateViewerByID(gfx::NativeWindow parent, int cert_id);
void ShowCertificateViewer(gfx::NativeWindow parent,
net::X509Certificate* cert);
-// Opens a certificate viewer under |parent| to display |cert| using a native
-// certificate viewer dialog.
-void ShowNativeCertificateViewer(gfx::NativeWindow parent,
- net::X509Certificate* cert);
-
#endif // CHROME_BROWSER_CERTIFICATE_VIEWER_H_
diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.cc b/chrome/browser/sync/test/integration/bookmarks_helper.cc
index d82cade..38edf82 100644
--- a/chrome/browser/sync/test/integration/bookmarks_helper.cc
+++ b/chrome/browser/sync/test/integration/bookmarks_helper.cc
@@ -406,14 +406,14 @@ const BookmarkNode* SetURL(int profile,
bookmark_utils::ApplyEditsWithNoFolderChange(
GetVerifierBookmarkModel(),
v_node->parent(),
- BookmarkEditor::EditDetails::EditNode(v_node),
+ BookmarkEditor::EditDetails(v_node),
v_node->GetTitle(),
new_url);
}
return bookmark_utils::ApplyEditsWithNoFolderChange(
GetBookmarkModel(profile),
node->parent(),
- BookmarkEditor::EditDetails::EditNode(node),
+ BookmarkEditor::EditDetails(node),
node->GetTitle(),
new_url);
}
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index abf5ee1..a234961 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -3114,12 +3114,13 @@ void Browser::BookmarkAllTabs() {
BookmarkModel* model = profile()->GetBookmarkModel();
DCHECK(model && model->IsLoaded());
- BookmarkEditor::EditDetails details =
- BookmarkEditor::EditDetails::AddFolder(model->GetParentForNewNodes());
+ BookmarkEditor::EditDetails details;
+ details.type = BookmarkEditor::EditDetails::NEW_FOLDER;
bookmark_utils::GetURLsForOpenTabs(this, &(details.urls));
DCHECK(!details.urls.empty());
- BookmarkEditor::Show(window()->GetNativeHandle(), profile_, details,
+ BookmarkEditor::Show(window()->GetNativeHandle(), profile_,
+ model->GetParentForNewNodes(), details,
BookmarkEditor::SHOW_TREE);
}
diff --git a/chrome/browser/ui/browser_dialogs.h b/chrome/browser/ui/browser_dialogs.h
index 4a8e64c..1981941 100644
--- a/chrome/browser/ui/browser_dialogs.h
+++ b/chrome/browser/ui/browser_dialogs.h
@@ -51,10 +51,6 @@ void ShowExtensionInstalledBubble(const Extension* extension,
void ShowHungRendererDialog(TabContents* contents);
void HideHungRendererDialog(TabContents* contents);
-// Native implementations of hung renderer dialogs.
-void ShowNativeHungRendererDialog(TabContents* contents);
-void HideNativeHungRendererDialog(TabContents* contents);
-
} // namespace browser
#endif // CHROME_BROWSER_UI_BROWSER_DIALOGS_H_
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
index 3569a61..2bd43da 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
@@ -588,16 +588,22 @@ void RecordAppLaunch(Profile* profile, GURL url) {
return;
}
- // This jumps to a platform-common routine at this point (which may just
- // jump back to objc or may use the WebUI dialog).
+#if defined(WEBUI_DIALOGS)
+ browser_->OpenBookmarkManagerEditNode(node->id());
+#else
+ // There is no real need to jump to a platform-common routine at
+ // this point (which just jumps back to objc) other than consistency
+ // across platforms.
//
// TODO(jrg): identify when we NO_TREE. I can see it in the code
// for the other platforms but can't find a way to trigger it in the
// UI.
BookmarkEditor::Show([[self view] window],
browser_->profile(),
- BookmarkEditor::EditDetails::EditNode(node),
+ node->parent(),
+ BookmarkEditor::EditDetails(node),
BookmarkEditor::SHOW_TREE);
+#endif
}
- (IBAction)cutBookmark:(id)sender {
@@ -675,10 +681,15 @@ void RecordAppLaunch(Profile* profile, GURL url) {
const BookmarkNode* parent = [self nodeFromMenuItem:sender];
if (!parent)
parent = bookmarkModel_->bookmark_bar_node();
+#if defined(WEBUI_DIALOGS)
+ browser_->OpenBookmarkManagerAddNodeIn(parent->id());
+#else
BookmarkEditor::Show([[self view] window],
browser_->profile(),
- BookmarkEditor::EditDetails::AddNodeInFolder(parent),
+ parent,
+ BookmarkEditor::EditDetails(),
BookmarkEditor::SHOW_TREE);
+#endif
}
// Might be called from the context menu over the bar OR over a
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.mm
index 340115a..6d37efd 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.mm
@@ -60,11 +60,11 @@
// static; implemented for each platform. Update this function for new
// classes derived from BookmarkEditorBaseController.
-void BookmarkEditor::ShowNative(gfx::NativeWindow parent_hwnd,
- Profile* profile,
- const BookmarkNode* parent,
- const EditDetails& details,
- Configuration configuration) {
+void BookmarkEditor::Show(gfx::NativeWindow parent_hwnd,
+ Profile* profile,
+ const BookmarkNode* parent,
+ const EditDetails& details,
+ Configuration configuration) {
BookmarkEditorBaseController* controller = nil;
if (details.type == EditDetails::NEW_FOLDER) {
controller = [[BookmarkAllTabsController alloc]
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index 06cc993..dba32f7 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -1629,6 +1629,10 @@ enum {
if (responds) {
const BookmarkNode* node = [sender node];
if (node) {
+#if defined(WEBUI_DIALOGS)
+ DCHECK(browser_);
+ browser_->OpenBookmarkManagerEditNode(node->id());
+#else
// A BookmarkEditorController is a sheet that owns itself, and
// deallocates itself when closed.
[[[BookmarkEditorController alloc]
@@ -1638,6 +1642,7 @@ enum {
node:node
configuration:BookmarkEditor::SHOW_TREE]
runAsModalSheet];
+#endif
}
}
}
diff --git a/chrome/browser/ui/cocoa/hung_renderer_controller.mm b/chrome/browser/ui/cocoa/hung_renderer_controller.mm
index 397146d..bab2472 100644
--- a/chrome/browser/ui/cocoa/hung_renderer_controller.mm
+++ b/chrome/browser/ui/cocoa/hung_renderer_controller.mm
@@ -215,7 +215,7 @@ class TabContentsObserverBridge : public TabContentsObserver {
namespace browser {
-void ShowNativeHungRendererDialog(TabContents* contents) {
+void ShowHungRendererDialog(TabContents* contents) {
if (!logging::DialogsAreSuppressed()) {
if (!g_instance)
g_instance = [[HungRendererController alloc]
@@ -224,7 +224,7 @@ void ShowNativeHungRendererDialog(TabContents* contents) {
}
}
-void HideNativeHungRendererDialog(TabContents* contents) {
+void HideHungRendererDialog(TabContents* contents) {
if (!logging::DialogsAreSuppressed() && g_instance)
[g_instance endForTabContents:contents];
}
diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc
index 4ace196..f0b57ab 100644
--- a/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc
+++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc
@@ -309,17 +309,25 @@ void BookmarkBubbleGtk::ShowEditor() {
// Commit any edits now.
ApplyEdits();
+#if !defined(WEBUI_DIALOGS)
// Closing might delete us, so we'll cache what we need on the stack.
Profile* profile = profile_;
GtkWindow* toplevel = GTK_WINDOW(gtk_widget_get_toplevel(anchor_));
+#endif
// Close the bubble, deleting the C++ objects, etc.
bubble_->Close();
if (node) {
- BookmarkEditor::Show(toplevel, profile,
- BookmarkEditor::EditDetails::EditNode(node),
+#if defined(WEBUI_DIALOGS)
+ Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ DCHECK(browser);
+ browser->OpenBookmarkManagerEditNode(node->id());
+#else
+ BookmarkEditor::Show(toplevel, profile, NULL,
+ BookmarkEditor::EditDetails(node),
BookmarkEditor::SHOW_TREE);
+#endif
}
}
diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc
index 9d54c96..1dd66f0 100644
--- a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc
+++ b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc
@@ -258,11 +258,11 @@ class BookmarkEditorGtk::ContextMenuController
};
// static
-void BookmarkEditor::ShowNative(gfx::NativeWindow parent_hwnd,
- Profile* profile,
- const BookmarkNode* parent,
- const EditDetails& details,
- Configuration configuration) {
+void BookmarkEditor::Show(gfx::NativeWindow parent_hwnd,
+ Profile* profile,
+ const BookmarkNode* parent,
+ const EditDetails& details,
+ Configuration configuration) {
DCHECK(profile);
BookmarkEditorGtk* editor =
new BookmarkEditorGtk(parent_hwnd, profile, parent, details,
diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk_unittest.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk_unittest.cc
index 7563edd..c8a0a0a 100644
--- a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk_unittest.cc
+++ b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk_unittest.cc
@@ -101,7 +101,7 @@ class BookmarkEditorGtkTest : public testing::Test {
// Makes sure the tree model matches that of the bookmark bar model.
TEST_F(BookmarkEditorGtkTest, ModelsMatch) {
BookmarkEditorGtk editor(NULL, profile_.get(), NULL,
- BookmarkEditor::EditDetails::AddNodeInFolder(NULL),
+ BookmarkEditor::EditDetails(),
BookmarkEditor::SHOW_TREE);
// The root should have two or three children, one for the bookmark bar node,
@@ -148,7 +148,7 @@ TEST_F(BookmarkEditorGtkTest, ModelsMatch) {
// Changes the title and makes sure parent/visual order doesn't change.
TEST_F(BookmarkEditorGtkTest, EditTitleKeepsPosition) {
BookmarkEditorGtk editor(NULL, profile_.get(), NULL,
- BookmarkEditor::EditDetails::EditNode(GetNode("a")),
+ BookmarkEditor::EditDetails(GetNode("a")),
BookmarkEditor::SHOW_TREE);
gtk_entry_set_text(GTK_ENTRY(editor.name_entry_), "new_a");
@@ -168,7 +168,7 @@ TEST_F(BookmarkEditorGtkTest, EditTitleKeepsPosition) {
TEST_F(BookmarkEditorGtkTest, EditURLKeepsPosition) {
Time node_time = GetNode("a")->date_added();
BookmarkEditorGtk editor(NULL, profile_.get(), NULL,
- BookmarkEditor::EditDetails::EditNode(GetNode("a")),
+ BookmarkEditor::EditDetails(GetNode("a")),
BookmarkEditor::SHOW_TREE);
gtk_entry_set_text(GTK_ENTRY(editor.url_entry_),
GURL(base_path() + "new_a").spec().c_str());
@@ -189,7 +189,7 @@ TEST_F(BookmarkEditorGtkTest, EditURLKeepsPosition) {
// Moves 'a' to be a child of the other node.
TEST_F(BookmarkEditorGtkTest, ChangeParent) {
BookmarkEditorGtk editor(NULL, profile_.get(), NULL,
- BookmarkEditor::EditDetails::EditNode(GetNode("a")),
+ BookmarkEditor::EditDetails(GetNode("a")),
BookmarkEditor::SHOW_TREE);
GtkTreeModel* store = GTK_TREE_MODEL(editor.tree_store_);
@@ -208,7 +208,7 @@ TEST_F(BookmarkEditorGtkTest, ChangeParent) {
TEST_F(BookmarkEditorGtkTest, ChangeParentAndURL) {
Time node_time = GetNode("a")->date_added();
BookmarkEditorGtk editor(NULL, profile_.get(), NULL,
- BookmarkEditor::EditDetails::EditNode(GetNode("a")),
+ BookmarkEditor::EditDetails(GetNode("a")),
BookmarkEditor::SHOW_TREE);
gtk_entry_set_text(GTK_ENTRY(editor.url_entry_),
@@ -229,7 +229,7 @@ TEST_F(BookmarkEditorGtkTest, ChangeParentAndURL) {
// Creates a new folder and moves a node to it.
TEST_F(BookmarkEditorGtkTest, MoveToNewParent) {
BookmarkEditorGtk editor(NULL, profile_.get(), NULL,
- BookmarkEditor::EditDetails::EditNode(GetNode("a")),
+ BookmarkEditor::EditDetails(GetNode("a")),
BookmarkEditor::SHOW_TREE);
GtkTreeIter bookmark_bar_node;
@@ -277,7 +277,7 @@ TEST_F(BookmarkEditorGtkTest, MoveToNewParent) {
// Brings up the editor, creating a new URL on the bookmark bar.
TEST_F(BookmarkEditorGtkTest, NewURL) {
BookmarkEditorGtk editor(NULL, profile_.get(), NULL,
- BookmarkEditor::EditDetails::AddNodeInFolder(NULL),
+ BookmarkEditor::EditDetails(),
BookmarkEditor::SHOW_TREE);
gtk_entry_set_text(GTK_ENTRY(editor.url_entry_),
@@ -301,7 +301,7 @@ TEST_F(BookmarkEditorGtkTest, NewURL) {
// Brings up the editor with no tree and modifies the url.
TEST_F(BookmarkEditorGtkTest, ChangeURLNoTree) {
BookmarkEditorGtk editor(NULL, profile_.get(), NULL,
- BookmarkEditor::EditDetails::EditNode(
+ BookmarkEditor::EditDetails(
model_->other_node()->GetChild(0)),
BookmarkEditor::NO_TREE);
@@ -323,7 +323,7 @@ TEST_F(BookmarkEditorGtkTest, ChangeURLNoTree) {
// Brings up the editor with no tree and modifies only the title.
TEST_F(BookmarkEditorGtkTest, ChangeTitleNoTree) {
BookmarkEditorGtk editor(NULL, profile_.get(), NULL,
- BookmarkEditor::EditDetails::EditNode(
+ BookmarkEditor::EditDetails(
model_->other_node()->GetChild(0)),
BookmarkEditor::NO_TREE);
gtk_entry_set_text(GTK_ENTRY(editor.name_entry_), "new_a");
diff --git a/chrome/browser/ui/gtk/certificate_viewer.cc b/chrome/browser/ui/gtk/certificate_viewer.cc
index 609514c..7a07793 100644
--- a/chrome/browser/ui/gtk/certificate_viewer.cc
+++ b/chrome/browser/ui/gtk/certificate_viewer.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/ui/gtk/certificate_viewer.h"
+
#include <gtk/gtk.h>
#include <algorithm>
@@ -12,7 +14,6 @@
#include "base/string_number_conversions.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
-#include "chrome/browser/certificate_viewer.h"
#include "chrome/browser/ui/gtk/certificate_dialogs.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "chrome/common/net/x509_certificate_model.h"
@@ -21,7 +22,6 @@
#include "ui/base/gtk/gtk_hig_constants.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/gtk_util.h"
-#include "ui/gfx/native_widget_types.h"
namespace {
@@ -708,14 +708,14 @@ void CertificateViewer::Show() {
} // namespace
-void ShowNativeCertificateViewer(gfx::NativeWindow parent,
- net::X509Certificate::OSCertHandle cert) {
+void ShowCertificateViewer(gfx::NativeWindow parent,
+ net::X509Certificate::OSCertHandle cert) {
net::X509Certificate::OSCertHandles cert_chain;
x509_certificate_model::GetCertChainFromCert(cert, &cert_chain);
(new CertificateViewer(parent, cert_chain))->Show();
}
-void ShowNativeCertificateViewer(gfx::NativeWindow parent,
- net::X509Certificate* cert) {
- ShowNativeCertificateViewer(parent, cert->os_cert_handle());
+void ShowCertificateViewer(gfx::NativeWindow parent,
+ net::X509Certificate* cert) {
+ ShowCertificateViewer(parent, cert->os_cert_handle());
}
diff --git a/chrome/browser/ui/gtk/certificate_viewer.h b/chrome/browser/ui/gtk/certificate_viewer.h
new file mode 100644
index 0000000..c31477c
--- /dev/null
+++ b/chrome/browser/ui/gtk/certificate_viewer.h
@@ -0,0 +1,16 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_CERTIFICATE_VIEWER_H_
+#define CHROME_BROWSER_UI_GTK_CERTIFICATE_VIEWER_H_
+#pragma once
+
+#include "chrome/browser/certificate_viewer.h"
+#include "net/base/x509_certificate.h"
+#include "ui/gfx/native_widget_types.h"
+
+void ShowCertificateViewer(gfx::NativeWindow parent,
+ net::X509Certificate::OSCertHandle);
+
+#endif // CHROME_BROWSER_UI_GTK_CERTIFICATE_VIEWER_H_
diff --git a/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc b/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc
index a4cae17..890166d 100644
--- a/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc
@@ -249,7 +249,7 @@ void HungRendererDialogGtk::OnResponse(GtkWidget* dialog, int response_id) {
namespace browser {
-void ShowNativeHungRendererDialog(TabContents* contents) {
+void ShowHungRendererDialog(TabContents* contents) {
if (!logging::DialogsAreSuppressed()) {
if (!g_instance)
g_instance = new HungRendererDialogGtk();
@@ -257,7 +257,7 @@ void ShowNativeHungRendererDialog(TabContents* contents) {
}
}
-void HideNativeHungRendererDialog(TabContents* contents) {
+void HideHungRendererDialog(TabContents* contents) {
if (!logging::DialogsAreSuppressed() && g_instance)
g_instance->EndForTabContents(contents);
}
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
index 108d2f4..529a13e 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
@@ -35,10 +35,6 @@
#include "views/layout/layout_constants.h"
#include "views/window/client_view.h"
-#if defined(TOOLKIT_USES_GTK)
-#include "views/widget/native_widget_gtk.h"
-#endif
-
using views::ColumnSet;
using views::GridLayout;
@@ -370,6 +366,7 @@ void BookmarkBubbleView::ShowEditor() {
const BookmarkNode* node =
profile_->GetBookmarkModel()->GetMostRecentlyAddedNodeForURL(url_);
+#if !defined(WEBUI_DIALOGS)
#if defined(USE_AURA)
NOTIMPLEMENTED();
gfx::NativeView parent = NULL;
@@ -391,15 +388,22 @@ void BookmarkBubbleView::ShowEditor() {
static_cast<views::NativeWidgetGtk*>(GetWidget()->native_widget())->
GetTransientParent());
#endif
+#endif
// Even though we just hid the window, we need to invoke Close to schedule
// the delete and all that.
Close();
if (node) {
- BookmarkEditor::Show(parent, profile_,
- BookmarkEditor::EditDetails::EditNode(node),
+#if defined(WEBUI_DIALOGS)
+ Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ DCHECK(browser);
+ browser->OpenBookmarkManagerEditNode(node->id());
+#else
+ BookmarkEditor::Show(parent, profile_, NULL,
+ BookmarkEditor::EditDetails(node),
BookmarkEditor::SHOW_TREE);
+#endif
}
}
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc
index ab7480c..94dd345 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.cc
@@ -130,9 +130,15 @@ void BookmarkContextMenuControllerViews::ExecuteCommand(int id) {
}
if (selection_[0]->is_url()) {
+#if defined(WEBUI_DIALOGS)
+ Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ DCHECK(browser);
+ browser->OpenBookmarkManagerEditNode(selection_[0]->id());
+#else
BookmarkEditor::Show(parent_widget_->GetNativeWindow(), profile_,
- BookmarkEditor::EditDetails::EditNode(selection_[0]),
+ parent_, BookmarkEditor::EditDetails(selection_[0]),
BookmarkEditor::SHOW_TREE);
+#endif
} else {
BookmarkFolderEditorController::Show(profile_,
parent_widget_->GetNativeWindow(), selection_[0], -1,
@@ -158,12 +164,17 @@ void BookmarkContextMenuControllerViews::ExecuteCommand(int id) {
UserMetrics::RecordAction(
UserMetricsAction("BookmarkBar_ContextMenu_Add"));
+#if defined(WEBUI_DIALOGS)
+ Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
+ DCHECK(browser);
+ browser->OpenBookmarkManagerAddNodeIn(selection_[0]->id());
+#else
// TODO: this should honor the index from GetParentForNewNodes.
BookmarkEditor::Show(
parent_widget_->GetNativeWindow(), profile_,
- BookmarkEditor::EditDetails::AddNodeInFolder(
- bookmark_utils::GetParentForNewNodes(parent_, selection_, NULL)),
- BookmarkEditor::SHOW_TREE);
+ bookmark_utils::GetParentForNewNodes(parent_, selection_, NULL),
+ BookmarkEditor::EditDetails(), BookmarkEditor::SHOW_TREE);
+#endif
break;
}
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc
index fd3fead..aed2f47 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc
@@ -47,11 +47,11 @@ const int kNewFolderButtonID = 1002;
} // namespace
// static
-void BookmarkEditor::ShowNative(gfx::NativeWindow parent_hwnd,
- Profile* profile,
- const BookmarkNode* parent,
- const EditDetails& details,
- Configuration configuration) {
+void BookmarkEditor::Show(gfx::NativeWindow parent_hwnd,
+ Profile* profile,
+ const BookmarkNode* parent,
+ const EditDetails& details,
+ Configuration configuration) {
DCHECK(profile);
BookmarkEditorView* editor =
new BookmarkEditorView(profile, parent, details, configuration);
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view_unittest.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view_unittest.cc
index 9bf17a7..3b37cc5 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view_unittest.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view_unittest.cc
@@ -130,8 +130,7 @@ class BookmarkEditorViewTest : public testing::Test {
// Makes sure the tree model matches that of the bookmark bar model.
TEST_F(BookmarkEditorViewTest, ModelsMatch) {
- CreateEditor(profile_.get(), NULL,
- BookmarkEditor::EditDetails::AddNodeInFolder(NULL),
+ CreateEditor(profile_.get(), NULL, BookmarkEditor::EditDetails(),
BookmarkEditorView::SHOW_TREE);
BookmarkEditorView::EditorNode* editor_root = editor_tree_model()->GetRoot();
// The root should have two or three children: bookmark bar, other bookmarks
@@ -160,8 +159,7 @@ TEST_F(BookmarkEditorViewTest, ModelsMatch) {
// Changes the title and makes sure parent/visual order doesn't change.
TEST_F(BookmarkEditorViewTest, EditTitleKeepsPosition) {
- CreateEditor(profile_.get(), NULL,
- BookmarkEditor::EditDetails::EditNode(GetNode("a")),
+ CreateEditor(profile_.get(), NULL, BookmarkEditor::EditDetails(GetNode("a")),
BookmarkEditorView::SHOW_TREE);
SetTitleText(L"new_a");
@@ -178,8 +176,7 @@ TEST_F(BookmarkEditorViewTest, EditTitleKeepsPosition) {
TEST_F(BookmarkEditorViewTest, EditURLKeepsPosition) {
Time node_time = Time::Now() + TimeDelta::FromDays(2);
GetMutableNode("a")->set_date_added(node_time);
- CreateEditor(profile_.get(), NULL,
- BookmarkEditor::EditDetails::EditNode(GetNode("a")),
+ CreateEditor(profile_.get(), NULL, BookmarkEditor::EditDetails(GetNode("a")),
BookmarkEditorView::SHOW_TREE);
SetURLText(UTF8ToWide(GURL(base_path() + "new_a").spec()));
@@ -196,8 +193,7 @@ TEST_F(BookmarkEditorViewTest, EditURLKeepsPosition) {
// Moves 'a' to be a child of the other node.
TEST_F(BookmarkEditorViewTest, ChangeParent) {
- CreateEditor(profile_.get(), NULL,
- BookmarkEditor::EditDetails::EditNode(GetNode("a")),
+ CreateEditor(profile_.get(), NULL, BookmarkEditor::EditDetails(GetNode("a")),
BookmarkEditorView::SHOW_TREE);
ApplyEdits(editor_tree_model()->GetRoot()->GetChild(1));
@@ -211,8 +207,7 @@ TEST_F(BookmarkEditorViewTest, ChangeParent) {
TEST_F(BookmarkEditorViewTest, ChangeParentAndURL) {
Time node_time = Time::Now() + TimeDelta::FromDays(2);
GetMutableNode("a")->set_date_added(node_time);
- CreateEditor(profile_.get(), NULL,
- BookmarkEditor::EditDetails::EditNode(GetNode("a")),
+ CreateEditor(profile_.get(), NULL, BookmarkEditor::EditDetails(GetNode("a")),
BookmarkEditorView::SHOW_TREE);
SetURLText(UTF8ToWide(GURL(base_path() + "new_a").spec()));
@@ -227,8 +222,7 @@ TEST_F(BookmarkEditorViewTest, ChangeParentAndURL) {
// Creates a new folder and moves a node to it.
TEST_F(BookmarkEditorViewTest, MoveToNewParent) {
- CreateEditor(profile_.get(), NULL,
- BookmarkEditor::EditDetails::EditNode(GetNode("a")),
+ CreateEditor(profile_.get(), NULL, BookmarkEditor::EditDetails(GetNode("a")),
BookmarkEditorView::SHOW_TREE);
// Create two nodes: "F21" as a child of "F2" and "F211" as a child of "F21".
@@ -261,8 +255,7 @@ TEST_F(BookmarkEditorViewTest, MoveToNewParent) {
// Brings up the editor, creating a new URL on the bookmark bar.
TEST_F(BookmarkEditorViewTest, NewURL) {
- CreateEditor(profile_.get(), NULL,
- BookmarkEditor::EditDetails::AddNodeInFolder(NULL),
+ CreateEditor(profile_.get(), NULL, BookmarkEditor::EditDetails(),
BookmarkEditorView::SHOW_TREE);
SetURLText(UTF8ToWide(GURL(base_path() + "a").spec()));
@@ -283,8 +276,7 @@ TEST_F(BookmarkEditorViewTest, NewURL) {
// Brings up the editor with no tree and modifies the url.
TEST_F(BookmarkEditorViewTest, ChangeURLNoTree) {
CreateEditor(profile_.get(), NULL,
- BookmarkEditor::EditDetails::EditNode(
- model_->other_node()->GetChild(0)),
+ BookmarkEditor::EditDetails(model_->other_node()->GetChild(0)),
BookmarkEditorView::NO_TREE);
SetURLText(UTF8ToWide(GURL(base_path() + "a").spec()));
@@ -304,8 +296,7 @@ TEST_F(BookmarkEditorViewTest, ChangeURLNoTree) {
// Brings up the editor with no tree and modifies only the title.
TEST_F(BookmarkEditorViewTest, ChangeTitleNoTree) {
CreateEditor(profile_.get(), NULL,
- BookmarkEditor::EditDetails::EditNode(
- model_->other_node()->GetChild(0)),
+ BookmarkEditor::EditDetails(model_->other_node()->GetChild(0)),
BookmarkEditorView::NO_TREE);
SetTitleText(L"new_a");
@@ -323,10 +314,10 @@ TEST_F(BookmarkEditorViewTest, ChangeTitleNoTree) {
// Creates a new folder.
TEST_F(BookmarkEditorViewTest, NewFolder) {
const BookmarkNode* bb_node = model_->bookmark_bar_node();
- BookmarkEditor::EditDetails details =
- BookmarkEditor::EditDetails::AddFolder(bb_node);
+ BookmarkEditor::EditDetails details;
details.urls.push_back(std::make_pair(GURL(base_path() + "x"),
ASCIIToUTF16("z")));
+ details.type = BookmarkEditor::EditDetails::NEW_FOLDER;
CreateEditor(profile_.get(), bb_node, details, BookmarkEditorView::SHOW_TREE);
// The url field shouldn't be visible.
@@ -352,10 +343,10 @@ TEST_F(BookmarkEditorViewTest, NewFolder) {
// Creates a new folder and selects a different folder for the folder to appear
// in then the editor is initially created showing.
TEST_F(BookmarkEditorViewTest, MoveFolder) {
- BookmarkEditor::EditDetails details = BookmarkEditor::EditDetails::AddFolder(
- model_->bookmark_bar_node());
+ BookmarkEditor::EditDetails details;
details.urls.push_back(std::make_pair(GURL(base_path() + "x"),
ASCIIToUTF16("z")));
+ details.type = BookmarkEditor::EditDetails::NEW_FOLDER;
CreateEditor(profile_.get(), model_->bookmark_bar_node(),
details, BookmarkEditorView::SHOW_TREE);
diff --git a/chrome/browser/ui/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc
index aa05ac8..f7f9aa8 100644
--- a/chrome/browser/ui/views/hung_renderer_view.cc
+++ b/chrome/browser/ui/views/hung_renderer_view.cc
@@ -554,7 +554,7 @@ static HungRendererDialogView* CreateHungRendererDialogView() {
namespace browser {
-void ShowNativeHungRendererDialog(TabContents* contents) {
+void ShowHungRendererDialog(TabContents* contents) {
if (!logging::DialogsAreSuppressed()) {
if (!g_instance)
g_instance = CreateHungRendererDialogView();
@@ -562,7 +562,7 @@ void ShowNativeHungRendererDialog(TabContents* contents) {
}
}
-void HideNativeHungRendererDialog(TabContents* contents) {
+void HideHungRendererDialog(TabContents* contents) {
if (!logging::DialogsAreSuppressed() && g_instance)
g_instance->EndForTabContents(contents);
}
diff --git a/chrome/browser/ui/webui/bookmarks_ui.cc b/chrome/browser/ui/webui/bookmarks_ui.cc
index d5ec1a4..6c78bcc 100644
--- a/chrome/browser/ui/webui/bookmarks_ui.cc
+++ b/chrome/browser/ui/webui/bookmarks_ui.cc
@@ -7,13 +7,7 @@
#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"
@@ -21,8 +15,6 @@
#include "grit/theme_resources.h"
#include "grit/theme_resources_standard.h"
#include "ui/base/resource/resource_bundle.h"
-#include "googleurl/src/gurl.h"
-
////////////////////////////////////////////////////////////////////////////////
//
@@ -68,33 +60,3 @@ 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);
-}
diff --git a/chrome/browser/ui/webui/certificate_viewer.cc b/chrome/browser/ui/webui/certificate_viewer.cc
index 4d50cb5db..e7a0f7c 100644
--- a/chrome/browser/ui/webui/certificate_viewer.cc
+++ b/chrome/browser/ui/webui/certificate_viewer.cc
@@ -5,15 +5,13 @@
#include "base/i18n/time_formatting.h"
#include "base/utf_string_conversions.h"
#include "base/string_number_conversions.h"
-#include "chrome/browser/certificate_viewer.h"
+#include "chrome/browser/ui/webui/certificate_viewer.h"
+#include "chrome/common/url_constants.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/gtk/certificate_dialogs.h"
-#include "chrome/browser/ui/webui/certificate_viewer.h"
-#include "chrome/browser/ui/webui/chrome_web_ui.h"
+#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/common/net/x509_certificate_model.h"
-#include "chrome/common/url_constants.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "ui/base/l10n/l10n_util.h"
#include "grit/generated_resources.h"
@@ -26,14 +24,10 @@ const int kDefaultHeight = 450;
} // namespace
-// Shows a certificate using the native or WebUI certificate viewer.
+// Shows a certificate using the WebUI certificate viewer.
void ShowCertificateViewer(gfx::NativeWindow parent,
net::X509Certificate* cert) {
- if (ChromeWebUI::IsMoreWebUI()) {
- CertificateViewerDialog::ShowDialog(parent, cert);
- } else {
- ShowNativeCertificateViewer(parent, cert);
- }
+ CertificateViewerDialog::ShowDialog(parent, cert);
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/ui/webui/certificate_viewer.h b/chrome/browser/ui/webui/certificate_viewer.h
index 0b621d0..1ebda6a 100644
--- a/chrome/browser/ui/webui/certificate_viewer.h
+++ b/chrome/browser/ui/webui/certificate_viewer.h
@@ -11,8 +11,7 @@
#include "net/base/x509_certificate.h"
#include "ui/gfx/native_widget_types.h"
-// Displays the native or WebUI certificate viewer dialog for the given
-// certificate.
+// Displays the WebUI certificate viewer dialog for the passed in certificate.
void ShowCertificateViewer(gfx::NativeWindow parent,
net::X509Certificate*);
diff --git a/chrome/browser/ui/webui/chrome_web_ui.cc b/chrome/browser/ui/webui/chrome_web_ui.cc
index cd9b0ee..885711c 100644
--- a/chrome/browser/ui/webui/chrome_web_ui.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui.cc
@@ -4,15 +4,9 @@
#include "chrome/browser/ui/webui/chrome_web_ui.h"
-#include "base/command_line.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/chrome_switches.h"
#include "content/browser/tab_contents/tab_contents.h"
-#if defined(TOOLKIT_VIEWS)
-#include "views/widget/widget.h"
-#endif
-
ChromeWebUI::ChromeWebUI(TabContents* contents)
: WebUI(contents),
force_bookmark_bar_visible_(false) {
@@ -24,13 +18,3 @@ ChromeWebUI::~ChromeWebUI() {
Profile* ChromeWebUI::GetProfile() const {
return Profile::FromBrowserContext(tab_contents()->browser_context());
}
-
-// static
-bool ChromeWebUI::IsMoreWebUI() {
- bool more_webui = CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kUseMoreWebUI);
-#if defined(TOOLKIT_VIEWS)
- more_webui |= views::Widget::IsPureViews();
-#endif
- return more_webui;
-}
diff --git a/chrome/browser/ui/webui/chrome_web_ui.h b/chrome/browser/ui/webui/chrome_web_ui.h
index 489e519..4b9ed85 100644
--- a/chrome/browser/ui/webui/chrome_web_ui.h
+++ b/chrome/browser/ui/webui/chrome_web_ui.h
@@ -24,10 +24,6 @@ class ChromeWebUI : public WebUI {
return force_bookmark_bar_visible_;
}
- // IsMoreWebUI returns a command line flag that tracks whether to use
- // available WebUI implementations of native dialogs.
- static bool IsMoreWebUI();
-
protected:
void set_force_bookmark_bar_visible(bool value) {
force_bookmark_bar_visible_ = value;
diff --git a/chrome/browser/ui/webui/chrome_web_ui_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_factory.cc
index 09aec3f..813e153 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_factory.cc
@@ -25,7 +25,6 @@
#include "chrome/browser/ui/webui/history2_ui.h"
#include "chrome/browser/ui/webui/history_ui.h"
#include "chrome/browser/ui/webui/html_dialog_ui.h"
-#include "chrome/browser/ui/webui/hung_renderer_dialog_ui.h"
#include "chrome/browser/ui/webui/media/media_internals_ui.h"
#include "chrome/browser/ui/webui/net_internals_ui.h"
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
@@ -70,10 +69,14 @@
#include "chrome/browser/ui/webui/conflicts_ui.h"
#endif
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(WEBUI_DIALOGS) && defined(OS_POSIX) && !defined(OS_MACOSX)
#include "chrome/browser/ui/webui/certificate_viewer_ui.h"
#endif
+#if defined(WEBUI_DIALOGS)
+#include "chrome/browser/ui/webui/hung_renderer_dialog_ui.h"
+#endif
+
namespace {
// A function for creating a new WebUI. The caller owns the return value, which
@@ -148,13 +151,15 @@ static WebUIFactoryFunction GetWebUIFactoryFunction(Profile* profile,
return &NewWebUI<BookmarksUI>;
if (url.host() == chrome::kChromeUIBugReportHost)
return &NewWebUI<BugReportUI>;
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(WEBUI_DIALOGS) && defined(OS_POSIX) && !defined(OS_MACOSX)
if (url.host() == chrome::kChromeUICertificateViewerHost)
return &NewWebUI<CertificateViewerUI>;
#endif
+#if defined(WEBUI_DIALOGS)
if (url.host() == chrome::kChromeUIHungRendererDialogHost) {
return &NewWebUI<HungRendererDialogUI>;
}
+#endif
if (url.host() == chrome::kChromeUICrashesHost)
return &NewWebUI<CrashesUI>;
if (url.host() == chrome::kChromeUIDevToolsHost)
diff --git a/chrome/browser/ui/webui/html_dialog_ui.cc b/chrome/browser/ui/webui/html_dialog_ui.cc
index 9f01d15..fd3341a 100644
--- a/chrome/browser/ui/webui/html_dialog_ui.cc
+++ b/chrome/browser/ui/webui/html_dialog_ui.cc
@@ -29,10 +29,6 @@ HtmlDialogUI::~HtmlDialogUI() {
// and the HTML dialogs won't swap WebUIs anyway since they don't navigate.
}
-void HtmlDialogUI::CloseDialog(const base::ListValue* args) {
- OnDialogClosed(args);
-}
-
// static
PropertyAccessor<HtmlDialogUIDelegate*>& HtmlDialogUI::GetPropertyAccessor() {
return g_html_dialog_ui_property_accessor.Get();
@@ -71,8 +67,8 @@ void HtmlDialogUI::OnDialogClosed(const ListValue* args) {
tab_contents()->property_bag());
if (delegate) {
std::string json_retval;
- if (args && !args->empty() && !args->GetString(0, &json_retval))
- NOTREACHED() << "Could not read JSON argument";
+ if (!args->GetString(0, &json_retval))
+ NOTREACHED() << "Could not read JSON arguments";
(*delegate)->OnDialogClosed(json_retval);
}
diff --git a/chrome/browser/ui/webui/html_dialog_ui.h b/chrome/browser/ui/webui/html_dialog_ui.h
index 9e26f85..264daa1 100644
--- a/chrome/browser/ui/webui/html_dialog_ui.h
+++ b/chrome/browser/ui/webui/html_dialog_ui.h
@@ -100,9 +100,6 @@ class HtmlDialogUI : public ChromeWebUI {
explicit HtmlDialogUI(TabContents* tab_contents);
virtual ~HtmlDialogUI();
- // Close the dialog, passing the specified arguments to the close handler.
- void CloseDialog(const base::ListValue* args);
-
// Returns the PropertyBag accessor object used to write the delegate pointer
// into the TabContents (see class-level comment above).
static PropertyAccessor<HtmlDialogUIDelegate*>& GetPropertyAccessor();
diff --git a/chrome/browser/ui/webui/hung_renderer_dialog.cc b/chrome/browser/ui/webui/hung_renderer_dialog.cc
index 13379cd..590c79a 100644
--- a/chrome/browser/ui/webui/hung_renderer_dialog.cc
+++ b/chrome/browser/ui/webui/hung_renderer_dialog.cc
@@ -8,13 +8,10 @@
#include <vector>
#include "base/json/json_reader.h"
-#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
-#include "chrome/browser/ui/webui/html_dialog_ui.h"
#include "chrome/common/logging_chrome.h"
#include "chrome/common/url_constants.h"
#include "content/browser/renderer_host/render_view_host.h"
@@ -22,6 +19,7 @@
#include "content/common/result_codes.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
+#include "views/widget/widget.h"
namespace {
HungRendererDialog* g_instance = NULL;
@@ -32,21 +30,11 @@ const int kHungRendererDialogHeight = 200;
namespace browser {
void ShowHungRendererDialog(TabContents* contents) {
- if (ChromeWebUI::IsMoreWebUI()) {
- HungRendererDialog::ShowHungRendererDialog(contents);
- return;
- }
-
- ShowNativeHungRendererDialog(contents);
+ HungRendererDialog::ShowHungRendererDialog(contents);
}
void HideHungRendererDialog(TabContents* contents) {
- if (ChromeWebUI::IsMoreWebUI()) {
- HungRendererDialog::HideHungRendererDialog(contents);
- return;
- }
-
- HideNativeHungRendererDialog(contents);
+ HungRendererDialog::HideHungRendererDialog(contents);
}
} // namespace browser
@@ -74,7 +62,6 @@ void HungRendererDialog::HideHungRendererDialog(TabContents* contents) {
HungRendererDialog::HungRendererDialog()
: contents_(NULL),
- handler_(NULL),
window_(NULL) {
}
@@ -83,7 +70,6 @@ void HungRendererDialog::ShowDialog(TabContents* contents) {
contents_ = contents;
Browser* browser = BrowserList::GetLastActive();
DCHECK(browser);
- handler_ = new HungRendererDialogHandler(contents_);
window_ = browser->BrowserShowHtmlDialog(this, NULL);
}
@@ -97,8 +83,9 @@ void HungRendererDialog::HideDialog(TabContents* contents) {
// We do this because the close dialog handler runs whether it is trigged by
// the user closing the box, or by being closed externally with widget->Close.
contents_ = NULL;
- DCHECK(handler_);
- handler_->CloseDialog();
+ views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window_);
+ DCHECK(widget);
+ widget->Close();
}
bool HungRendererDialog::IsDialogModal() const {
@@ -115,7 +102,7 @@ GURL HungRendererDialog::GetDialogContentURL() const {
void HungRendererDialog::GetWebUIMessageHandlers(
std::vector<WebUIMessageHandler*>* handlers) const {
- handlers->push_back(handler_);
+ handlers->push_back(new HungRendererDialogHandler(contents_));
}
void HungRendererDialog::GetDialogSize(gfx::Size* size) const {
@@ -168,11 +155,6 @@ HungRendererDialogHandler::HungRendererDialogHandler(
: contents_(contents) {
}
-void HungRendererDialogHandler::CloseDialog() {
- DCHECK(web_ui_);
- static_cast<HtmlDialogUI*>(web_ui_)->CloseDialog(NULL);
-}
-
void HungRendererDialogHandler::RegisterMessages() {
web_ui_->RegisterMessageCallback("requestTabContentsList",
NewCallback(this,
diff --git a/chrome/browser/ui/webui/hung_renderer_dialog.h b/chrome/browser/ui/webui/hung_renderer_dialog.h
index e26a8a1..aa9eebc 100644
--- a/chrome/browser/ui/webui/hung_renderer_dialog.h
+++ b/chrome/browser/ui/webui/hung_renderer_dialog.h
@@ -15,7 +15,6 @@
#include "ui/gfx/native_widget_types.h"
class TabContents;
-class HungRendererDialogHandler;
class HungRendererDialog : private HtmlDialogUIDelegate {
public:
@@ -50,9 +49,6 @@ class HungRendererDialog : private HtmlDialogUIDelegate {
// The tab contents.
TabContents* contents_;
- // The dialog handler.
- HungRendererDialogHandler* handler_;
-
// The dialog window.
gfx::NativeWindow window_;
@@ -65,8 +61,6 @@ class HungRendererDialogHandler : public WebUIMessageHandler {
public:
explicit HungRendererDialogHandler(TabContents* contents);
- void CloseDialog();
-
// Overridden from WebUIMessageHandler
virtual void RegisterMessages();
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index f48f291..9d85137 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2822,6 +2822,7 @@
'browser/ui/gtk/certificate_dialogs.cc',
'browser/ui/gtk/certificate_dialogs.h',
'browser/ui/gtk/certificate_viewer.cc',
+ 'browser/ui/gtk/certificate_viewer.h',
'browser/ui/gtk/chrome_gtk_frame.cc',
'browser/ui/gtk/chrome_gtk_frame.h',
'browser/ui/gtk/collected_cookies_gtk.cc',
@@ -4115,9 +4116,14 @@
'../ui/aura/aura.gyp:aura',
],
}],
- # Exclude WebUI certificate viewer if not POSIX or mac (these OS's have
- # native certificate viewers).
- ['os_posix == 0 or OS == "mac"', {
+ ['webui_dialogs == 1', {
+ 'defines': [
+ 'WEBUI_DIALOGS',
+ ],
+ }],
+ # Exclude WebUI certificate viewer if not POSIX, mac (these OS's have
+ # native certificate viewers) or WebUI dialogs are disabled.
+ ['webui_dialogs == 0 or os_posix == 0 or OS == "mac"', {
'sources/': [
['exclude', '^browser/ui/webui/certificate_viewer.cc'],
['exclude', '^browser/ui/webui/certificate_viewer.h'],
@@ -4125,6 +4131,23 @@
['exclude', '^browser/ui/webui/certificate_viewer_ui.h'],
],
}],
+ # Exclude other WebUI dialogs if WebUI dialogs are disabled.
+ ['webui_dialogs == 0', {
+ 'sources/': [
+ ['exclude', '^browser/ui/webui/hung_renderer_dialog.cc'],
+ ['exclude', '^browser/ui/webui/hung_renderer_dialog.h'],
+ ['exclude', '^browser/ui/webui/hung_renderer_dialog_ui.cc'],
+ ['exclude', '^browser/ui/webui/hung_renderer_dialog_ui.h'],
+ ],
+ }],
+ ['webui_dialogs == 1', {
+ 'sources/': [
+ ['exclude', '^browser/ui/gtk/certificate_viewer.cc'],
+ ['exclude', '^browser/ui/gtk/certificate_viewer.h'],
+ ['exclude', '^browser/ui/gtk/hung_renderer_dialog_gtk.cc'],
+ ['exclude', '^browser/ui/gtk/hung_renderer_dialog_gtk.h'],
+ ],
+ }],
['toolkit_uses_gtk == 1', {
'dependencies': [
'../build/linux/system.gyp:dbus',
@@ -4449,6 +4472,7 @@
['include', '^browser/ui/gtk/certificate_dialogs.cc'],
['include', '^browser/ui/gtk/certificate_dialogs.h'],
['include', '^browser/ui/gtk/certificate_viewer.cc'],
+ ['include', '^browser/ui/gtk/certificate_viewer.h'],
['include', '^browser/ui/gtk/chrome_gtk_frame.cc'],
['include', '^browser/ui/gtk/chrome_gtk_frame.h'],
['include', '^browser/ui/gtk/collected_cookies_gtk.cc'],
@@ -4761,6 +4785,15 @@
['exclude', '^browser/ui/panels/panel_mouse_watcher_gtk.cc'],
],
}],
+ # Exclude the GTK versions of dialogs if webui_dialogs are enabled.
+ ['webui_dialogs==1', {
+ 'sources/': [
+ ['exclude', '^browser/ui/gtk/certificate_viewer.cc'],
+ ['exclude', '^browser/ui/gtk/certificate_viewer.h'],
+ ['exclude', '^browser/ui/gtk/hung_renderer_dialog_gtk.cc'],
+ ['exclude', '^browser/ui/gtk/hung_renderer_dialog_gtk.cc.h'],
+ ],
+ }],
# Exclude these toolkit_views specific files again.
# (Required because of the '^browser/extensions/' include above)
['toolkit_views==0', {
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index f45b0f5..fb7fb33 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -999,10 +999,6 @@ const char kTryChromeAgain[] = "try-chrome-again";
// Runs un-installation steps that were done by chrome first-run.
const char kUninstall[] = "uninstall";
-// Use WebUI versions of dialogs when available (rather than platform native
-// implementations).
-const char kUseMoreWebUI[] = "use-more-webui";
-
// Use a pure Views implementation when available (rather rather than platform
// native implementation such as GTK).
const char kUsePureViews[] = "use-pure-views";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 4338e3d..601f642 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -268,7 +268,6 @@ extern const char kTestType[];
extern const char kTestingChannelID[];
extern const char kTryChromeAgain[];
extern const char kUninstall[];
-extern const char kUseMoreWebUI[];
extern const char kUsePureViews[];
extern const char kUseSpdy[];
extern const char kIgnoreCertificateErrors[];