Commit d11e0730 authored by tfarina@chromium.org's avatar tfarina@chromium.org

browser/ui: Share BookmarkBarInstructions delegate between gtk and views.

R=ben@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10787037

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148042 0039d316-1c4b-4281-b951-d872f2087c98
parent eda6bfe0
// Copyright (c) 2012 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_BOOKMARKS_BOOKMARK_BAR_INSTRUCTIONS_DELEGATE_H_
#define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_BAR_INSTRUCTIONS_DELEGATE_H_
namespace chrome {
// The delegate is notified once the user clicks on the link to import
// bookmarks.
class BookmarkBarInstructionsDelegate {
public:
virtual void ShowImportDialog() = 0;
protected:
virtual ~BookmarkBarInstructionsDelegate() {}
};
} // namespace chrome
#endif // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_BAR_INSTRUCTIONS_DELEGATE_H_
......@@ -22,6 +22,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.h"
#include "chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.h"
#include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h"
#include "chrome/browser/ui/gtk/browser_window_gtk.h"
......
......@@ -17,7 +17,7 @@
#include "chrome/browser/bookmarks/bookmark_model_observer.h"
#include "chrome/browser/prefs/pref_member.h"
#include "chrome/browser/ui/bookmarks/bookmark_bar.h"
#include "chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.h"
#include "chrome/browser/ui/bookmarks/bookmark_bar_instructions_delegate.h"
#include "chrome/browser/ui/gtk/menu_bar_helper.h"
#include "chrome/browser/ui/gtk/view_id_util.h"
#include "content/public/browser/notification_observer.h"
......@@ -30,6 +30,7 @@
#include "ui/gfx/point.h"
#include "ui/gfx/size.h"
class BookmarkBarInstructionsGtk;
class BookmarkMenuController;
class Browser;
class BrowserWindowGtk;
......@@ -45,7 +46,7 @@ class BookmarkBarGtk : public ui::AnimationDelegate,
public BookmarkModelObserver,
public MenuBarHelper::Delegate,
public content::NotificationObserver,
public BookmarkBarInstructionsGtk::Delegate,
public chrome::BookmarkBarInstructionsDelegate,
public BookmarkContextMenuControllerDelegate {
public:
// The NTP needs to have access to this.
......@@ -292,7 +293,7 @@ class BookmarkBarGtk : public ui::AnimationDelegate,
// |throbbing_widget_| callback.
CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnThrobbingWidgetDestroy);
// Overriden from BookmarkBarInstructionsGtk::Delegate.
// Overriden from chrome::BookmarkBarInstructionsDelegate:
virtual void ShowImportDialog() OVERRIDE;
// Updates the drag&drop state when |edit_bookmarks_enabled_| changes.
......
......@@ -5,6 +5,7 @@
#include "chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.h"
#include "base/observer_list.h"
#include "chrome/browser/ui/bookmarks/bookmark_bar_instructions_delegate.h"
#include "chrome/browser/ui/gtk/gtk_chrome_link_button.h"
#include "chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h"
#include "chrome/browser/ui/gtk/gtk_theme_service.h"
......@@ -14,8 +15,9 @@
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
BookmarkBarInstructionsGtk::BookmarkBarInstructionsGtk(Delegate* delegate,
Profile* profile)
BookmarkBarInstructionsGtk::BookmarkBarInstructionsGtk(
chrome::BookmarkBarInstructionsDelegate* delegate,
Profile* profile)
: delegate_(delegate),
profile_(profile),
theme_service_(GtkThemeService::GetFrom(profile_)) {
......
......@@ -15,19 +15,14 @@ typedef struct _GtkWidget GtkWidget;
class GtkThemeService;
class Profile;
namespace chrome {
class BookmarkBarInstructionsDelegate;
}
class BookmarkBarInstructionsGtk : public content::NotificationObserver {
public:
// The delegate is notified once the user clicks on the link to import
// bookmarks.
class Delegate {
public:
virtual void ShowImportDialog() = 0;
protected:
virtual ~Delegate() {}
};
BookmarkBarInstructionsGtk(Delegate* delegate, Profile* profile);
BookmarkBarInstructionsGtk(chrome::BookmarkBarInstructionsDelegate* delegate,
Profile* profile);
// Get the native widget.
GtkWidget* widget() const { return instructions_hbox_; }
......@@ -43,7 +38,7 @@ class BookmarkBarInstructionsGtk : public content::NotificationObserver {
// Sets the correct color for |instructions_label_| and |instructions_link_|.
void UpdateColors();
Delegate* delegate_;
chrome::BookmarkBarInstructionsDelegate* delegate_;
Profile* profile_;
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 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.
......@@ -9,6 +9,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/ui/bookmarks/bookmark_bar_instructions_delegate.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/controls/label.h"
......@@ -21,7 +22,8 @@ const int kViewPadding = 6;
} // namespace
BookmarkBarInstructionsView::BookmarkBarInstructionsView(Delegate* delegate)
BookmarkBarInstructionsView::BookmarkBarInstructionsView(
chrome::BookmarkBarInstructionsDelegate* delegate)
: delegate_(delegate),
instructions_(NULL),
import_link_(NULL),
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 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.
......@@ -11,6 +11,9 @@
#include "ui/views/controls/link_listener.h"
#include "ui/views/view.h"
namespace chrome {
class BookmarkBarInstructionsDelegate;
}
namespace views {
class Label;
class Link;
......@@ -24,17 +27,8 @@ class Link;
class BookmarkBarInstructionsView : public views::View,
public views::LinkListener {
public:
// The delegate is notified once the user clicks on the link to import
// bookmarks.
class Delegate {
public:
virtual void ShowImportDialog() = 0;
protected:
virtual ~Delegate() {}
};
explicit BookmarkBarInstructionsView(Delegate* delegate);
explicit BookmarkBarInstructionsView(
chrome::BookmarkBarInstructionsDelegate* delegate);
// views::View overrides.
virtual gfx::Size GetPreferredSize() OVERRIDE;
......@@ -51,7 +45,7 @@ class BookmarkBarInstructionsView : public views::View,
private:
void UpdateColors();
Delegate* delegate_;
chrome::BookmarkBarInstructionsDelegate* delegate_;
views::Label* instructions_;
views::Link* import_link_;
......
......@@ -31,6 +31,7 @@
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h"
#include "chrome/browser/ui/views/event_utils.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
......
......@@ -15,7 +15,7 @@
#include "chrome/browser/bookmarks/bookmark_model_observer.h"
#include "chrome/browser/bookmarks/bookmark_node_data.h"
#include "chrome/browser/ui/bookmarks/bookmark_bar.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h"
#include "chrome/browser/ui/bookmarks/bookmark_bar_instructions_delegate.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h"
#include "chrome/browser/ui/views/detachable_toolbar_view.h"
#include "content/public/browser/notification_observer.h"
......@@ -61,7 +61,7 @@ class BookmarkBarView : public DetachableToolbarView,
public views::DragController,
public ui::AnimationDelegate,
public BookmarkMenuController::Observer,
public BookmarkBarInstructionsView::Delegate {
public chrome::BookmarkBarInstructionsDelegate {
public:
// The internal view class name.
static const char kViewClassName[];
......@@ -179,18 +179,18 @@ class BookmarkBarView : public DetachableToolbarView,
virtual void OnThemeChanged() OVERRIDE;
virtual std::string GetClassName() const OVERRIDE;
// AccessiblePaneView methods:
// AccessiblePaneView:
virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
// SlideAnimationDelegate implementation.
// ui::AnimationDelegate:
virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
// BookmarkMenuController::Observer
// BookmarkMenuController::Observer:
virtual void BookmarkMenuDeleted(
BookmarkMenuController* controller) OVERRIDE;
// BookmarkBarInstructionsView::Delegate.
// chrome::BookmarkBarInstructionsDelegate:
virtual void ShowImportDialog() OVERRIDE;
// BookmarkModelObserver:
......
......@@ -2435,6 +2435,7 @@
'browser/ui/blocked_content/blocked_content_tab_helper_delegate.cc',
'browser/ui/blocked_content/blocked_content_tab_helper_delegate.h',
'browser/ui/bookmarks/bookmark_bar.h',
'browser/ui/bookmarks/bookmark_bar_instructions_delegate.h',
'browser/ui/bookmarks/bookmark_tab_helper.cc',
'browser/ui/bookmarks/bookmark_tab_helper.h',
'browser/ui/bookmarks/bookmark_tab_helper_delegate.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment