summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-23 20:37:29 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-23 20:37:29 +0000
commitb7ca4e69c194f4392fd0d7749221152bee6c6a4f (patch)
treeea87a258f659cde6c748b54e39ce0fc66c70c3fd /chrome/browser/views
parenta3e4dd79aa7550b6a43ec1fb87e1026ec524f7d5 (diff)
downloadchromium_src-b7ca4e69c194f4392fd0d7749221152bee6c6a4f.zip
chromium_src-b7ca4e69c194f4392fd0d7749221152bee6c6a4f.tar.gz
chromium_src-b7ca4e69c194f4392fd0d7749221152bee6c6a4f.tar.bz2
Don't expose the go and star button views directly through the BrowserWindow interface (for porting).
Review URL: http://codereview.chromium.org/18540 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8572 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/frame/browser_view.cc40
-rw-r--r--chrome/browser/views/frame/browser_view.h11
-rw-r--r--chrome/browser/views/info_bubble.cc2
-rw-r--r--chrome/browser/views/tabs/dragged_tab_controller.cc4
4 files changed, 32 insertions, 25 deletions
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index d9939f3..7b6909e 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -30,6 +30,7 @@
#include "chrome/browser/views/status_bubble_views.h"
#include "chrome/browser/views/tab_contents_container_view.h"
#include "chrome/browser/views/tabs/tab_strip.h"
+#include "chrome/browser/views/toolbar_star_toggle.h"
#include "chrome/browser/views/toolbar_view.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/web_contents.h"
@@ -70,7 +71,7 @@ static const int kStatusBubbleVerticalOverlap = 2;
static const int kSeparationLineHeight = 1;
// The name of a key to store on the window handle so that other code can
// locate this object using just the handle.
-static const wchar_t* kBrowserWindowKey = L"__BROWSER_WINDOW__";
+static const wchar_t* kBrowserViewKey = L"__BROWSER_VIEW__";
// The distance between tiled windows.
static const int kWindowTilePixels = 10;
// How frequently we check for hung plugin windows.
@@ -140,11 +141,11 @@ BrowserView::~BrowserView() {
}
// static
-BrowserWindow* BrowserView::GetBrowserWindowForHWND(HWND window) {
+BrowserView* BrowserView::GetBrowserViewForHWND(HWND window) {
if (IsWindow(window)) {
- HANDLE data = GetProp(window, kBrowserWindowKey);
+ HANDLE data = GetProp(window, kBrowserViewKey);
if (data)
- return reinterpret_cast<BrowserWindow*>(data);
+ return reinterpret_cast<BrowserView*>(data);
}
return NULL;
}
@@ -323,7 +324,7 @@ void BrowserView::RegisterBrowserViewPrefs(PrefService* prefs) {
void BrowserView::Init() {
// Stow a pointer to this object onto the window handle so that we can get
// at it later when all we have is a HWND.
- SetProp(GetWidget()->GetHWND(), kBrowserWindowKey, this);
+ SetProp(GetWidget()->GetHWND(), kBrowserViewKey, this);
// Start a hung plugin window detector for this browser object (as long as
// hang detection is not disabled).
@@ -423,10 +424,6 @@ BrowserWindowTesting* BrowserView::GetBrowserWindowTesting() {
return this;
}
-TabStrip* BrowserView::GetTabStrip() const {
- return tabstrip_;
-}
-
StatusBubble* BrowserView::GetStatusBubble() {
return status_bubble_.get();
}
@@ -465,6 +462,10 @@ void BrowserView::UpdateLoadingAnimations(bool should_animate) {
}
}
+void BrowserView::SetStarredState(bool is_starred) {
+ toolbar_->star_button()->SetToggled(is_starred);
+}
+
gfx::Rect BrowserView::GetNormalBounds() const {
WINDOWPLACEMENT wp;
wp.length = sizeof(wp);
@@ -477,22 +478,19 @@ bool BrowserView::IsMaximized() {
return frame_->GetWindow()->IsMaximized();
}
-ToolbarStarToggle* BrowserView::GetStarButton() const {
- return toolbar_->star_button();
-}
-
LocationBarView* BrowserView::GetLocationBarView() const {
return toolbar_->GetLocationBarView();
}
-GoButton* BrowserView::GetGoButton() const {
- return toolbar_->GetGoButton();
-}
-
BrowserView* BrowserView::GetBrowserView() const {
return NULL;
}
+void BrowserView::UpdateStopGoState(bool is_loading) {
+ toolbar_->GetGoButton()->ChangeMode(
+ is_loading ? GoButton::MODE_STOP : GoButton::MODE_GO);
+}
+
void BrowserView::UpdateToolbar(TabContents* contents,
bool should_restore_state) {
toolbar_->Update(contents, should_restore_state);
@@ -538,6 +536,14 @@ void BrowserView::ShowBookmarkManager() {
BookmarkManagerView::Show(browser_->profile());
}
+bool BrowserView::IsBookmarkBubbleVisible() const {
+ return toolbar_->star_button()->is_bubble_showing();
+}
+
+void BrowserView::ShowBookmarkBubble(const GURL& url, bool already_bookmarked) {
+ toolbar_->star_button()->ShowStarBubble(url, !already_bookmarked);
+}
+
void BrowserView::ShowReportBugDialog() {
// Retrieve the URL for the current tab (if any) and tell the BugReportView
TabContents* current_tab = browser_->GetSelectedTabContents();
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index 9473337..891f288 100644
--- a/chrome/browser/views/frame/browser_view.h
+++ b/chrome/browser/views/frame/browser_view.h
@@ -45,10 +45,10 @@ class BrowserView : public BrowserWindow,
void set_frame(BrowserFrame* frame) { frame_ = frame; }
- // Returns a pointer to the BrowserWindow* interface implementation (an
+ // Returns a pointer to the BrowserView* interface implementation (an
// instance of this object, typically) for a given HWND, or NULL if there is
// no such association.
- static BrowserWindow* GetBrowserWindowForHWND(HWND window);
+ static BrowserView* GetBrowserViewForHWND(HWND window);
// Returns the show flag that should be used to show the frame containing
// this view.
@@ -155,17 +155,16 @@ class BrowserView : public BrowserWindow,
virtual void FlashFrame();
virtual void* GetNativeHandle();
virtual BrowserWindowTesting* GetBrowserWindowTesting();
- virtual TabStrip* GetTabStrip() const;
virtual StatusBubble* GetStatusBubble();
virtual void SelectedTabToolbarSizeChanged(bool is_animating);
virtual void UpdateTitleBar();
virtual void UpdateLoadingAnimations(bool should_animate);
+ virtual void SetStarredState(bool is_starred);
virtual gfx::Rect GetNormalBounds() const;
virtual bool IsMaximized();
- virtual ToolbarStarToggle* GetStarButton() const;
virtual LocationBarView* GetLocationBarView() const;
- virtual GoButton* GetGoButton() const;
virtual BrowserView* GetBrowserView() const;
+ virtual void UpdateStopGoState(bool is_loading);
virtual void UpdateToolbar(TabContents* contents, bool should_restore_state);
virtual void FocusToolbar();
virtual void DestroyBrowser();
@@ -173,6 +172,8 @@ class BrowserView : public BrowserWindow,
virtual void ToggleBookmarkBar();
virtual void ShowAboutChromeDialog();
virtual void ShowBookmarkManager();
+ virtual bool IsBookmarkBubbleVisible() const;
+ virtual void ShowBookmarkBubble(const GURL& url, bool already_bookmarked);
virtual void ShowReportBugDialog();
virtual void ShowClearBrowsingDataDialog();
virtual void ShowImportDialog();
diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc
index cef17bb..ebee987 100644
--- a/chrome/browser/views/info_bubble.cc
+++ b/chrome/browser/views/info_bubble.cc
@@ -91,7 +91,7 @@ void InfoBubble::Init(HWND parent_hwnd,
// We should always have a frame, but there was a bug elsewhere that
// made it possible for the frame to be NULL, so we have the check. If
// you hit this, file a bug.
- DCHECK(BrowserView::GetBrowserWindowForHWND(owning_frame_hwnd));
+ DCHECK(BrowserView::GetBrowserViewForHWND(owning_frame_hwnd));
parent_ = reinterpret_cast<views::Window*>(win_util::GetWindowUserData(
owning_frame_hwnd));
parent_->DisableInactiveRendering(true);
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc
index 36dfb62..6334c7b 100644
--- a/chrome/browser/views/tabs/dragged_tab_controller.cc
+++ b/chrome/browser/views/tabs/dragged_tab_controller.cc
@@ -690,11 +690,11 @@ TabStrip* DraggedTabController::GetTabStripForPoint(
dock_windows_.erase(dragged_hwnd);
if (!local_window)
return NULL;
- BrowserWindow* browser = BrowserView::GetBrowserWindowForHWND(local_window);
+ BrowserView* browser = BrowserView::GetBrowserViewForHWND(local_window);
if (!browser)
return NULL;
- TabStrip* other_tabstrip = browser->GetTabStrip();
+ TabStrip* other_tabstrip = browser->tabstrip();
if (!other_tabstrip->IsCompatibleWith(source_tabstrip_))
return NULL;
return GetTabStripIfItContains(other_tabstrip, screen_point);