diff options
author | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-05 21:52:58 +0000 |
---|---|---|
committer | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-05 21:52:58 +0000 |
commit | c3240722a63ff142684575e3ea4eb89915edae72 (patch) | |
tree | 43339cacbf2b834c501ee76cc51d71c7e286d21c /chrome/browser | |
parent | f515eece5f790dc20f51c32718642bd9fa9e7261 (diff) | |
download | chromium_src-c3240722a63ff142684575e3ea4eb89915edae72.zip chromium_src-c3240722a63ff142684575e3ea4eb89915edae72.tar.gz chromium_src-c3240722a63ff142684575e3ea4eb89915edae72.tar.bz2 |
Add some bookmark bar hooks for pyauto.
Refactor the implementation for x-platform happiness.
Add simple pyauto script that uses it (but needs http://crbug.com32292
fixed before it works without tweaking).
Review URL: http://codereview.chromium.org/670001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40782 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 15 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider_gtk.cc | 7 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider_mac.mm | 7 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider_win.cc | 19 | ||||
-rw-r--r-- | chrome/browser/browser_window.h | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/browser_window_cocoa.h | 1 | ||||
-rw-r--r-- | chrome/browser/cocoa/browser_window_cocoa.mm | 4 | ||||
-rw-r--r-- | chrome/browser/cocoa/browser_window_controller.h | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/browser_window_controller.mm | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/browser_window_gtk.cc | 6 | ||||
-rw-r--r-- | chrome/browser/gtk/browser_window_gtk.h | 1 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 7 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.h | 1 |
13 files changed, 45 insertions, 33 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 8c1de8c..6a29cba 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -1266,6 +1266,21 @@ void AutomationProvider::HandleFindWindowLocationRequest(int handle, int* x, *y = position.y(); } +void AutomationProvider::GetBookmarkBarVisibility(int handle, + bool* visible, + bool* animating) { + *visible = false; + *animating = false; + + if (browser_tracker_->ContainsHandle(handle)) { + Browser* browser = browser_tracker_->GetResource(handle); + if (browser) { + *visible = browser->window()->IsBookmarkBarVisible(); + *animating = browser->window()->IsBookmarkBarAnimating(); + } + } +} + void AutomationProvider::HandleInspectElementRequest( int handle, int x, int y, IPC::Message* reply_message) { TabContents* tab_contents = GetTabContentsForHandle(handle, NULL); diff --git a/chrome/browser/automation/automation_provider_gtk.cc b/chrome/browser/automation/automation_provider_gtk.cc index eaed3b5..45623a2 100644 --- a/chrome/browser/automation/automation_provider_gtk.cc +++ b/chrome/browser/automation/automation_provider_gtk.cc @@ -92,13 +92,6 @@ void AutomationProvider::SetInitialFocus(const IPC::Message& message, NOTIMPLEMENTED(); } -void AutomationProvider::GetBookmarkBarVisibility(int handle, bool* visible, - bool* animating) { - *visible = false; - *animating = false; - NOTIMPLEMENTED(); -} - // This task sends a WindowDragResponse message with the appropriate // routing ID to the automation proxy. This is implemented as a task so that // we know that the mouse events (and any tasks that they spawn on the message diff --git a/chrome/browser/automation/automation_provider_mac.mm b/chrome/browser/automation/automation_provider_mac.mm index 78ac739..b475f4d 100644 --- a/chrome/browser/automation/automation_provider_mac.mm +++ b/chrome/browser/automation/automation_provider_mac.mm @@ -117,13 +117,6 @@ void AutomationProvider::SetInitialFocus(const IPC::Message& message, NOTIMPLEMENTED(); } -void AutomationProvider::GetBookmarkBarVisibility(int handle, bool* visible, - bool* animating) { - *visible = false; - *animating = false; - NOTIMPLEMENTED(); -} - void AutomationProvider::WindowSimulateDrag(int handle, std::vector<gfx::Point> drag_path, int flags, diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc index d31836f9..ecdcd57 100644 --- a/chrome/browser/automation/automation_provider_win.cc +++ b/chrome/browser/automation/automation_provider_win.cc @@ -244,25 +244,6 @@ void AutomationProvider::GetFocusedViewID(int handle, int* view_id) { } } -void AutomationProvider::GetBookmarkBarVisibility(int handle, bool* visible, - bool* animating) { - *visible = false; - *animating = false; - - if (browser_tracker_->ContainsHandle(handle)) { - Browser* browser = browser_tracker_->GetResource(handle); - if (browser) { - BrowserWindowTesting* testing = - browser->window()->GetBrowserWindowTesting(); - BookmarkBarView* bookmark_bar = testing->GetBookmarkBarView(); - if (bookmark_bar) { - *animating = bookmark_bar->IsAnimating(); - *visible = browser->window()->IsBookmarkBarVisible(); - } - } - } -} - void AutomationProvider::GetWindowBounds(int handle, gfx::Rect* bounds, bool* success) { *success = false; diff --git a/chrome/browser/browser_window.h b/chrome/browser/browser_window.h index 152e7dc..d4cf1309 100644 --- a/chrome/browser/browser_window.h +++ b/chrome/browser/browser_window.h @@ -151,6 +151,9 @@ class BrowserWindow { // Returns whether the bookmark bar is visible or not. virtual bool IsBookmarkBarVisible() const = 0; + // Returns whether the bookmark bar is animating or not. + virtual bool IsBookmarkBarAnimating() const = 0; + // Returns whether the tool bar is visible or not. virtual bool IsToolbarVisible() const = 0; diff --git a/chrome/browser/cocoa/browser_window_cocoa.h b/chrome/browser/cocoa/browser_window_cocoa.h index 2b5fb44..b0ace80 100644 --- a/chrome/browser/cocoa/browser_window_cocoa.h +++ b/chrome/browser/cocoa/browser_window_cocoa.h @@ -58,6 +58,7 @@ class BrowserWindowCocoa : public BrowserWindow, bool should_restore_state); virtual void FocusToolbar(); virtual bool IsBookmarkBarVisible() const; + virtual bool IsBookmarkBarAnimating() const; virtual bool IsToolbarVisible() const; virtual gfx::Rect GetRootWindowResizerRect() const; virtual void ConfirmAddSearchProvider(const TemplateURL* template_url, diff --git a/chrome/browser/cocoa/browser_window_cocoa.mm b/chrome/browser/cocoa/browser_window_cocoa.mm index 2ebda45..42a68c8 100644 --- a/chrome/browser/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/cocoa/browser_window_cocoa.mm @@ -241,6 +241,10 @@ bool BrowserWindowCocoa::IsBookmarkBarVisible() const { return browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar); } +bool BrowserWindowCocoa::IsBookmarkBarAnimating() const { + return [controller_ isBookmarkBarAnimating]; +} + bool BrowserWindowCocoa::IsToolbarVisible() const { return browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) || browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR); diff --git a/chrome/browser/cocoa/browser_window_controller.h b/chrome/browser/cocoa/browser_window_controller.h index 86d86ce..70f6a8a 100644 --- a/chrome/browser/cocoa/browser_window_controller.h +++ b/chrome/browser/cocoa/browser_window_controller.h @@ -182,6 +182,9 @@ class TabStripModelObserverBridge; - (BOOL)isBookmarkBarVisible; +// Returns YES if the bookmark bar is currently animating. +- (BOOL)isBookmarkBarAnimating; + // Called after bookmark bar visibility changes (due to pref change or change in // tab/tab contents). - (void)updateBookmarkBarVisibilityWithAnimation:(BOOL)animate; diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm index 04b17a2..55f15d4 100644 --- a/chrome/browser/cocoa/browser_window_controller.mm +++ b/chrome/browser/cocoa/browser_window_controller.mm @@ -1197,6 +1197,10 @@ return [bookmarkBarController_ isVisible]; } +- (BOOL)isBookmarkBarAnimating { + return [bookmarkBarController_ isAnimationRunning]; +} + - (void)updateBookmarkBarVisibilityWithAnimation:(BOOL)animate { [bookmarkBarController_ updateAndShowNormalBar:[self shouldShowBookmarkBar] diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index 2de3b84..6bcb176 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -787,6 +787,12 @@ bool BrowserWindowGtk::IsBookmarkBarVisible() const { bookmark_bar_.get(); } +bool BrowserWindowGtk::IsBookmarkBarAnimating() const { + if (IsBookmarkBarSupported() && bookmark_bar_->IsAnimating()) + return true; + return false; +} + bool BrowserWindowGtk::IsToolbarVisible() const { return IsToolbarSupported(); } diff --git a/chrome/browser/gtk/browser_window_gtk.h b/chrome/browser/gtk/browser_window_gtk.h index 1cbfab0..18ba31f 100644 --- a/chrome/browser/gtk/browser_window_gtk.h +++ b/chrome/browser/gtk/browser_window_gtk.h @@ -76,6 +76,7 @@ class BrowserWindowGtk : public BrowserWindow, bool should_restore_state); virtual void FocusToolbar(); virtual bool IsBookmarkBarVisible() const; + virtual bool IsBookmarkBarAnimating() const; virtual bool IsToolbarVisible() const; virtual gfx::Rect GetRootWindowResizerRect() const; virtual void ConfirmAddSearchProvider(const TemplateURL* template_url, diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 7e7aece..0948c96 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -893,6 +893,13 @@ bool BrowserView::IsBookmarkBarVisible() const { (active_bookmark_bar_->GetPreferredSize().height() != 0); } +bool BrowserView::IsBookmarkBarAnimating() const { + if (bookmark_bar_view_.get() && + bookmark_bar_view_->IsAnimating()) + return true; + return false; +} + bool BrowserView::IsToolbarVisible() const { return browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) || browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR); diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index f2d1978..e683fdf 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -265,6 +265,7 @@ class BrowserView : public BrowserBubbleHost, virtual void FocusToolbar(); virtual void DestroyBrowser(); virtual bool IsBookmarkBarVisible() const; + virtual bool IsBookmarkBarAnimating() const; virtual bool IsToolbarVisible() const; virtual gfx::Rect GetRootWindowResizerRect() const; virtual void DisableInactiveFrame(); |