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

Unified Diff: chrome/browser/gtk/bookmark_context_menu_gtk.cc

Issue 261013: Renames browser/gtk/bookmark_context_menu to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 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/gtk/bookmark_context_menu_gtk.h ('k') | chrome/browser/gtk/bookmark_manager_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/bookmark_context_menu_gtk.cc
===================================================================
--- chrome/browser/gtk/bookmark_context_menu_gtk.cc (revision 28297)
+++ chrome/browser/gtk/bookmark_context_menu_gtk.cc (working copy)
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/gtk/bookmark_context_menu.h"
+#include "chrome/browser/gtk/bookmark_context_menu_gtk.h"
#include "app/l10n_util.h"
#include "base/compiler_specific.h"
@@ -21,11 +21,6 @@
#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
-// TODO(port): Port these files.
-#if defined(OS_WIN)
-#include "views/window/window.h"
-#endif
-
namespace {
// Returns true if the specified node is of type URL, or has a descendant
@@ -106,11 +101,7 @@
ALLOW_UNUSED const BookmarkNode* node =
model_->AddGroup(node_, node_->GetChildCount(), text);
if (show_in_manager_) {
-#if defined(OS_WIN) || (defined(OS_LINUX) && !defined(TOOLKIT_VIEWS))
BookmarkManager::SelectInTree(profile_, node);
-#else
- NOTIMPLEMENTED() << "BookmarkManager not yet implemented";
-#endif
}
} else {
model_->SetTitle(node_, text);
@@ -183,7 +174,6 @@
DISALLOW_COPY_AND_ASSIGN(EditFolderController);
};
-#if defined(OS_WIN) || (defined(OS_LINUX) && !defined(TOOLKIT_VIEWS))
// SelectOnCreationHandler ----------------------------------------------------
// Used when adding a new bookmark. If a new bookmark is created it is selected
@@ -202,13 +192,12 @@
DISALLOW_COPY_AND_ASSIGN(SelectOnCreationHandler);
};
-#endif // #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(TOOLKIT_VIEWS))
} // namespace
-// BookmarkContextMenu -------------------------------------------
+// BookmarkContextMenuGtk -------------------------------------------
-BookmarkContextMenu::BookmarkContextMenu(
+BookmarkContextMenuGtk::BookmarkContextMenuGtk(
gfx::NativeView wnd,
Profile* profile,
Browser* browser,
@@ -291,16 +280,20 @@
model_->AddObserver(this);
}
-BookmarkContextMenu::~BookmarkContextMenu() {
+BookmarkContextMenuGtk::~BookmarkContextMenuGtk() {
if (model_)
model_->RemoveObserver(this);
}
-void BookmarkContextMenu::DelegateDestroyed() {
+void BookmarkContextMenuGtk::PopupAsContext(guint32 event_time) {
+ menu_->PopupAsContext(event_time);
+}
+
+void BookmarkContextMenuGtk::DelegateDestroyed() {
delegate_ = NULL;
}
-void BookmarkContextMenu::ExecuteCommand(int id) {
+void BookmarkContextMenuGtk::ExecuteCommand(int id) {
if (delegate_)
delegate_->WillExecuteCommand();
@@ -340,7 +333,6 @@
}
if (selection_[0]->is_url()) {
-#if defined(OS_WIN) || (defined(OS_LINUX) && !defined(TOOLKIT_VIEWS))
BookmarkEditor::Configuration editor_config;
if (configuration_ == BOOKMARK_BAR)
editor_config = BookmarkEditor::SHOW_TREE;
@@ -348,9 +340,6 @@
editor_config = BookmarkEditor::NO_TREE;
BookmarkEditor::Show(wnd_, profile_, parent_, selection_[0],
editor_config, NULL);
-#else
- NOTIMPLEMENTED();
-#endif
} else {
EditFolderController::Show(profile_, wnd_, selection_[0], false,
false);
@@ -372,7 +361,6 @@
case IDS_BOOMARK_BAR_ADD_NEW_BOOKMARK: {
UserMetrics::RecordAction(L"BookmarkBar_ContextMenu_Add", profile_);
-#if defined(OS_WIN) || (defined(OS_LINUX) && !defined(TOOLKIT_VIEWS))
BookmarkEditor::Configuration editor_config;
BookmarkEditor::Handler* handler = NULL;
if (configuration_ == BOOKMARK_BAR) {
@@ -384,9 +372,6 @@
}
BookmarkEditor::Show(wnd_, profile_, GetParentForNewNodes(), NULL,
editor_config, handler);
-#else
- NOTIMPLEMENTED();
-#endif
break;
}
@@ -411,20 +396,12 @@
return;
}
-#if defined(OS_WIN) || (defined(OS_LINUX) && !defined(TOOLKIT_VIEWS))
BookmarkManager::SelectInTree(profile_, selection_[0]);
-#else
- NOTIMPLEMENTED() << "Bookmark Manager not implemented";
-#endif
break;
case IDS_BOOKMARK_MANAGER:
UserMetrics::RecordAction(L"ShowBookmarkManager", profile_);
-#if defined(OS_WIN) || (defined(OS_LINUX) && !defined(TOOLKIT_VIEWS))
BookmarkManager::Show(profile_);
-#else
- NOTIMPLEMENTED() << "Bookmark Manager not implemented";
-#endif
break;
case IDS_BOOKMARK_MANAGER_SORT:
@@ -457,12 +434,12 @@
}
}
-bool BookmarkContextMenu::IsItemChecked(int id) const {
+bool BookmarkContextMenuGtk::IsItemChecked(int id) const {
DCHECK(id == IDS_BOOMARK_BAR_ALWAYS_SHOW);
return profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar);
}
-bool BookmarkContextMenu::IsCommandEnabled(int id) const {
+bool BookmarkContextMenuGtk::IsCommandEnabled(int id) const {
bool is_root_node =
(selection_.size() == 1 &&
selection_[0]->GetParent() == model_->root_node());
@@ -507,53 +484,73 @@
return true;
}
-void BookmarkContextMenu::BookmarkModelBeingDeleted(BookmarkModel* model) {
+void BookmarkContextMenuGtk::BookmarkModelBeingDeleted(BookmarkModel* model) {
ModelChanged();
}
-void BookmarkContextMenu::BookmarkNodeMoved(BookmarkModel* model,
- const BookmarkNode* old_parent,
- int old_index,
- const BookmarkNode* new_parent,
- int new_index) {
+void BookmarkContextMenuGtk::BookmarkNodeMoved(BookmarkModel* model,
+ const BookmarkNode* old_parent,
+ int old_index,
+ const BookmarkNode* new_parent,
+ int new_index) {
ModelChanged();
}
-void BookmarkContextMenu::BookmarkNodeAdded(BookmarkModel* model,
- const BookmarkNode* parent,
- int index) {
+void BookmarkContextMenuGtk::BookmarkNodeAdded(BookmarkModel* model,
+ const BookmarkNode* parent,
+ int index) {
ModelChanged();
}
-void BookmarkContextMenu::BookmarkNodeRemoved(BookmarkModel* model,
- const BookmarkNode* parent,
- int index,
- const BookmarkNode* node) {
+void BookmarkContextMenuGtk::BookmarkNodeRemoved(BookmarkModel* model,
+ const BookmarkNode* parent,
+ int index,
+ const BookmarkNode* node) {
ModelChanged();
}
-void BookmarkContextMenu::BookmarkNodeChanged(BookmarkModel* model,
- const BookmarkNode* node) {
+void BookmarkContextMenuGtk::BookmarkNodeChanged(BookmarkModel* model,
+ const BookmarkNode* node) {
ModelChanged();
}
-void BookmarkContextMenu::BookmarkNodeChildrenReordered(
+void BookmarkContextMenuGtk::BookmarkNodeChildrenReordered(
BookmarkModel* model, const BookmarkNode* node) {
ModelChanged();
}
-void BookmarkContextMenu::ModelChanged() {
+void BookmarkContextMenuGtk::ModelChanged() {
menu_->Cancel();
}
-BookmarkModel* BookmarkContextMenu::RemoveModelObserver() {
+void BookmarkContextMenuGtk::CreateMenuObject() {
+ menu_.reset(new MenuGtk(this, false));
+}
+
+void BookmarkContextMenuGtk::AppendItem(int id) {
+ menu_->AppendMenuItemWithLabel(id, l10n_util::GetStringUTF8(id));
+}
+
+void BookmarkContextMenuGtk::AppendItem(int id, int localization_id) {
+ menu_->AppendMenuItemWithLabel(id, l10n_util::GetStringUTF8(localization_id));
+}
+
+void BookmarkContextMenuGtk::AppendSeparator() {
+ menu_->AppendSeparator();
+}
+
+void BookmarkContextMenuGtk::AppendCheckboxItem(int id) {
+ menu_->AppendCheckMenuItemWithLabel(id, l10n_util::GetStringUTF8(id));
+}
+
+BookmarkModel* BookmarkContextMenuGtk::RemoveModelObserver() {
BookmarkModel* model = model_;
model_->RemoveObserver(this);
model_ = NULL;
return model;
}
-bool BookmarkContextMenu::HasURLs() const {
+bool BookmarkContextMenuGtk::HasURLs() const {
for (size_t i = 0; i < selection_.size(); ++i) {
if (NodeHasURLs(selection_[i]))
return true;
@@ -561,7 +558,7 @@
return false;
}
-const BookmarkNode* BookmarkContextMenu::GetParentForNewNodes() const {
+const BookmarkNode* BookmarkContextMenuGtk::GetParentForNewNodes() const {
return (selection_.size() == 1 && selection_[0]->is_folder()) ?
selection_[0] : parent_;
}
Property changes on: chrome/browser/gtk/bookmark_context_menu_gtk.cc
___________________________________________________________________
Added: svn:mergeinfo
Merged /branches/chrome_webkit_merge_branch/chrome/browser/gtk/bookmark_context_menu.cc:r69-2775
« no previous file with comments | « chrome/browser/gtk/bookmark_context_menu_gtk.h ('k') | chrome/browser/gtk/bookmark_manager_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698