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

Unified Diff: chrome/browser/ui/gtk/bookmark_sub_menu_model_gtk.h

Issue 8775029: Makes gtk show the 'mobile' bookmark folder where appropriate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | « no previous file | chrome/browser/ui/gtk/bookmark_sub_menu_model_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/bookmark_sub_menu_model_gtk.h
diff --git a/chrome/browser/ui/gtk/bookmark_sub_menu_model_gtk.h b/chrome/browser/ui/gtk/bookmark_sub_menu_model_gtk.h
deleted file mode 100644
index 1e42c7a7b7500e7d045e9b5cdc1036583a99e8f8..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/gtk/bookmark_sub_menu_model_gtk.h
+++ /dev/null
@@ -1,120 +0,0 @@
-// 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_BOOKMARK_SUB_MENU_MODEL_GTK_H_
-#define CHROME_BROWSER_UI_GTK_BOOKMARK_SUB_MENU_MODEL_GTK_H_
-#pragma once
-
-#include <vector>
-
-#include "chrome/browser/bookmarks/base_bookmark_model_observer.h"
-#include "ui/base/models/simple_menu_model.h"
-#include "webkit/glue/window_open_disposition.h"
-
-class Browser;
-class BookmarkModel;
-class BookmarkNode;
-class MenuGtk; // See below for why we need this.
-class PageNavigator;
-
-// BookmarkNodeMenuModel builds a SimpleMenuModel on demand when the menu is
-// shown, and automatically destroys child models when the menu is closed.
-class BookmarkNodeMenuModel : public ui::SimpleMenuModel {
- public:
- BookmarkNodeMenuModel(ui::SimpleMenuModel::Delegate* delegate,
- BookmarkModel* model,
- const BookmarkNode* node,
- PageNavigator* page_navigator);
- virtual ~BookmarkNodeMenuModel();
-
- // From SimpleMenuModel. Takes care of deleting submenus.
- // Note that this is not virtual. That's OK for our use.
- void Clear();
-
- // From MenuModel via SimpleMenuModel.
- virtual void MenuWillShow() OVERRIDE;
- virtual void MenuClosed() OVERRIDE;
- virtual void ActivatedAt(int index) OVERRIDE;
- virtual void ActivatedAt(int index, int event_flags) OVERRIDE;
-
- protected:
- // Adds all bookmark items to the model. Does not clear the model first.
- void PopulateMenu();
-
- // Add a submenu for the given bookmark folder node.
- void AddSubMenuForNode(const BookmarkNode* node);
-
- BookmarkModel* model() const { return model_; }
- void set_model(BookmarkModel* model) { model_ = model; }
-
- const BookmarkNode* node() const { return node_; }
- void set_node(const BookmarkNode* node) { node_ = node; }
-
- private:
- // Uses the page navigator to open the bookmark at the given index.
- void NavigateToMenuItem(int index, WindowOpenDisposition disposition);
-
- // The bookmark model whose bookmarks we will show. Note that in the top-level
- // bookmark menu, this may be null. (It is set only when the menu is shown.)
- BookmarkModel* model_;
-
- // The bookmark node for the folder that this model will show. Note that in
- // the top-level bookmark menu, this may be null, as above.
- const BookmarkNode* node_;
-
- // The page navigator used to open bookmarks in ActivatedAt().
- PageNavigator* page_navigator_;
-
- // A list of the submenus we own and will need to delete.
- std::vector<BookmarkNodeMenuModel*> submenus_;
-
- DISALLOW_COPY_AND_ASSIGN(BookmarkNodeMenuModel);
-};
-
-// This is the top-level bookmark menu model. It handles prepending a few fixed
-// items before the bookmarks. Child menus are all plain BookmarkNodeMenuModels.
-// This class also handles watching the bookmark model and forcing the menu to
-// close if it changes while the menu is open.
-class BookmarkSubMenuModel : public BookmarkNodeMenuModel,
- public BaseBookmarkModelObserver {
- public:
- BookmarkSubMenuModel(ui::SimpleMenuModel::Delegate* delegate,
- Browser* browser);
-
- virtual ~BookmarkSubMenuModel();
-
- // See below; this is used to allow closing the menu when bookmarks change.
- void SetMenuGtk(MenuGtk* menu) { menu_ = menu; }
-
- // From BaseBookmarkModelObserver.
- virtual void BookmarkModelChanged() OVERRIDE;
- virtual void BookmarkModelBeingDeleted(BookmarkModel* model) OVERRIDE;
-
- // From MenuModel via BookmarkNodeMenuModel, SimpleMenuModel.
- virtual void MenuWillShow() OVERRIDE;
- virtual void ActivatedAt(int index) OVERRIDE;
- virtual void ActivatedAt(int index, int event_flags) OVERRIDE;
- virtual bool IsEnabledAt(int index) const OVERRIDE;
- virtual bool IsVisibleAt(int index) const OVERRIDE;
-
- // Returns true if the command id is for a bookmark item.
- static bool IsBookmarkItemCommandId(int command_id);
-
- private:
- Browser* browser_;
-
- // The number of fixed items shown before the bookmarks.
- int fixed_items_;
- // The index of the first non-bookmark item after the bookmarks.
- int bookmark_end_;
-
- // We need to be able to call Cancel() on the menu when bookmarks change. This
- // is a bit of an abstraction violation but it could be converted to an
- // interface with just a Cancel() method if necessary.
- MenuGtk* menu_;
-
- DISALLOW_COPY_AND_ASSIGN(BookmarkSubMenuModel);
-};
-
-#endif // CHROME_BROWSER_UI_GTK_BOOKMARK_SUB_MENU_MODEL_GTK_H_
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/bookmark_sub_menu_model_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698