diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 24 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider.h | 3 | ||||
-rw-r--r-- | chrome/browser/browser_window.h | 5 | ||||
-rw-r--r-- | chrome/browser/find_in_page_controller_uitest.cc | 5 | ||||
-rw-r--r-- | chrome/browser/views/bookmark_bar_view.cc | 6 | ||||
-rw-r--r-- | chrome/browser/views/bookmark_bar_view.h | 5 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 14 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.h | 1 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view2.cc | 13 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view2.h | 1 | ||||
-rw-r--r-- | chrome/browser/vista_frame.cc | 13 | ||||
-rw-r--r-- | chrome/browser/vista_frame.h | 1 | ||||
-rw-r--r-- | chrome/browser/xp_frame.cc | 13 | ||||
-rw-r--r-- | chrome/browser/xp_frame.h | 1 |
14 files changed, 98 insertions, 7 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 5158c80..b831a71 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -23,6 +23,7 @@ #include "chrome/browser/save_package.h" #include "chrome/browser/ssl_blocking_page.h" #include "chrome/browser/web_contents.h" +#include "chrome/browser/views/bookmark_bar_view.h" #include "chrome/browser/views/location_bar_view.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/automation/automation_messages.h" @@ -755,6 +756,8 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) { GetFindWindowVisibility) IPC_MESSAGE_HANDLER(AutomationMsg_FindWindowLocationRequest, HandleFindWindowLocationRequest) + IPC_MESSAGE_HANDLER(AutomationMsg_BookmarkBarVisibilityRequest, + GetBookmarkBarVisitility) IPC_END_MESSAGE_MAP() } @@ -1720,6 +1723,27 @@ void AutomationProvider::HandleFindWindowLocationRequest( x, y)); } +void AutomationProvider::GetBookmarkBarVisitility(const IPC::Message& message, + int handle) { + bool visible = false; + bool animating = false; + + void* iter = NULL; + if (browser_tracker_->ContainsHandle(handle)) { + Browser* browser = browser_tracker_->GetResource(handle); + if (browser) { + BookmarkBarView* bookmark_bar = browser->window()->GetBookmarkBarView(); + if (bookmark_bar) { + animating = bookmark_bar->IsAnimating(); + visible = browser->window()->IsBookmarkBarVisible(); + } + } + } + + Send(new AutomationMsg_BookmarkBarVisibilityResponse(message.routing_id(), + visible, animating)); +} + void AutomationProvider::HandleInspectElementRequest( const IPC::Message& message, int handle, int x, int y) { WebContents* web_contents = GetWebContentsForHandle(handle, NULL); diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 370eeb3..674565c 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -208,6 +208,9 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, // Responds to requests to find the location of the Find window. void HandleFindWindowLocationRequest(const IPC::Message& message, int handle); + // Get the visibility state of the Bookmark bar. + void GetBookmarkBarVisitility(const IPC::Message& message, int handle); + // Responds to InspectElement request void HandleInspectElementRequest(const IPC::Message& message, int handle, diff --git a/chrome/browser/browser_window.h b/chrome/browser/browser_window.h index 43957c0..271d0cc 100644 --- a/chrome/browser/browser_window.h +++ b/chrome/browser/browser_window.h @@ -179,11 +179,14 @@ class BrowserWindow { const gfx::Rect& bounds, int show_command); + // Returns whether the bookmark bar is visible or not. + virtual bool IsBookmarkBarVisible() const = 0; + protected: friend class BrowserList; friend class BrowserView; virtual void DestroyBrowser() = 0; }; -#endif // #ifndef CHROME_BROWSER_BROWSER_WINDOW_H__ +#endif // CHROME_BROWSER_BROWSER_WINDOW_H__ diff --git a/chrome/browser/find_in_page_controller_uitest.cc b/chrome/browser/find_in_page_controller_uitest.cc index e40d09c..0fd4012 100644 --- a/chrome/browser/find_in_page_controller_uitest.cc +++ b/chrome/browser/find_in_page_controller_uitest.cc @@ -122,7 +122,7 @@ TEST_F(FindInPageControllerTest, FindEnoughMatches_Issue1341577) { // The find window should not change its location just because we open and close // a new tab. -TEST_F(FindInPageControllerTest, DISABLED_FindMovesOnTabClose_Issue1343052) { +TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) { TestServer server(L"chrome/test/data"); GURL url = server.TestServerPageW(kFramePage); @@ -134,6 +134,7 @@ TEST_F(FindInPageControllerTest, DISABLED_FindMovesOnTabClose_Issue1343052) { // Toggle the bookmark bar state. browser->ApplyAccelerator(IDC_SHOW_BOOKMARKS_BAR); + EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), true)); // Open the Find window and wait for it to animate. EXPECT_TRUE(tabA->OpenFindInPage()); @@ -159,7 +160,7 @@ TEST_F(FindInPageControllerTest, DISABLED_FindMovesOnTabClose_Issue1343052) { // Now reset the bookmarks bar state and try the same again. browser->ApplyAccelerator(IDC_SHOW_BOOKMARKS_BAR); - Sleep(kWaitForActionMsec); + EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), false)); // Bookmark bar has moved, reset our coordinates. EXPECT_TRUE(tabA->GetFindWindowLocation(&x, &y)); diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index fb9d579..191aa04 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -265,7 +265,7 @@ class BookmarkButton : public ChromeViews::TextButton { Profile* profile_; scoped_ptr<SlideAnimation> show_animation_; - DISALLOW_EVIL_CONSTRUCTORS(BookmarkButton); + DISALLOW_COPY_AND_ASSIGN(BookmarkButton); }; // DropInfo ------------------------------------------------------------------- @@ -545,7 +545,7 @@ class MenuRunner : public ChromeViews::MenuDelegate, scoped_ptr<BookmarkBarContextMenuController> context_menu_; - DISALLOW_EVIL_CONSTRUCTORS(MenuRunner); + DISALLOW_COPY_AND_ASSIGN(MenuRunner); }; // ButtonSeparatorView -------------------------------------------------------- @@ -585,7 +585,7 @@ class ButtonSeparatorView : public ChromeViews::View { } private: - DISALLOW_EVIL_CONSTRUCTORS(ButtonSeparatorView); + DISALLOW_COPY_AND_ASSIGN(ButtonSeparatorView); }; } // namespace diff --git a/chrome/browser/views/bookmark_bar_view.h b/chrome/browser/views/bookmark_bar_view.h index d48780c..d9bd48b 100644 --- a/chrome/browser/views/bookmark_bar_view.h +++ b/chrome/browser/views/bookmark_bar_view.h @@ -135,6 +135,9 @@ class BookmarkBarView : public ChromeViews::View, // True if we're supposed to draw the bookmarks bar in the new tab style. bool IsNewTabPage(); + // Whether or not we are animating. + bool IsAnimating() { return size_animation_->IsAnimating(); } + // SlideAnimationDelegate implementation. void AnimationProgressed(const Animation* animation); void AnimationEnded(const Animation* animation); @@ -194,7 +197,7 @@ class BookmarkBarView : public ChromeViews::View, BookmarkBarView* view_; BookmarkBarNode* node_; - DISALLOW_EVIL_CONSTRUCTORS(ShowFolderDropMenuTask); + DISALLOW_COPY_AND_ASSIGN(ShowFolderDropMenuTask); }; // Creates recent bookmark button and when visible button as well as diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index ab02f4c..b35958c 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -188,6 +188,20 @@ void BrowserView::DestroyBrowser() { frame_->DestroyBrowser(); } +bool BrowserView::IsBookmarkBarVisible() const { + BookmarkBarView* bookmark_bar_view = frame_->GetBookmarkBarView(); + if (!bookmark_bar_view) + return false; + + if (bookmark_bar_view->IsNewTabPage() || bookmark_bar_view->IsAnimating()) + return true; + + CSize sz; + bookmark_bar_view->GetPreferredSize(&sz); + // 1 is the minimum in GetPreferredSize for the bookmark bar. + return sz.cy > 1; +} + /////////////////////////////////////////////////////////////////////////////// // BrowserView, ChromeViews::ClientView overrides: diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index e8ffc03..5d48fc7 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -69,6 +69,7 @@ class BrowserView : public BrowserWindow, virtual void ProfileChanged(Profile* profile); virtual void FocusToolbar(); virtual void DestroyBrowser(); + virtual bool IsBookmarkBarVisible() const; /* // Overridden from ChromeViews::ClientView: diff --git a/chrome/browser/views/frame/browser_view2.cc b/chrome/browser/views/frame/browser_view2.cc index db3eedf..64c210d 100644 --- a/chrome/browser/views/frame/browser_view2.cc +++ b/chrome/browser/views/frame/browser_view2.cc @@ -440,6 +440,19 @@ void BrowserView2::FocusToolbar() { void BrowserView2::DestroyBrowser() { } +bool BrowserView2::IsBookmarkBarVisible() const { + if (!bookmark_bar_view_.get()) + return false; + + if (bookmark_bar_view_->IsNewTabPage() || bookmark_bar_view_->IsAnimating()) + return true; + + CSize sz; + bookmark_bar_view_->GetPreferredSize(&sz); + // 1 is the minimum in GetPreferredSize for the bookmark bar. + return sz.cy > 1; +} + /////////////////////////////////////////////////////////////////////////////// // BrowserView2, NotificationObserver implementation: diff --git a/chrome/browser/views/frame/browser_view2.h b/chrome/browser/views/frame/browser_view2.h index 40b4a4c..3f6d276 100644 --- a/chrome/browser/views/frame/browser_view2.h +++ b/chrome/browser/views/frame/browser_view2.h @@ -162,6 +162,7 @@ class BrowserView2 : public BrowserWindow, virtual void UpdateToolbar(TabContents* contents, bool should_restore_state); virtual void FocusToolbar(); virtual void DestroyBrowser(); + virtual bool IsBookmarkBarVisible() const; // Overridden from NotificationObserver: virtual void Observe(NotificationType type, diff --git a/chrome/browser/vista_frame.cc b/chrome/browser/vista_frame.cc index b1b0ebb3..779ada5 100644 --- a/chrome/browser/vista_frame.cc +++ b/chrome/browser/vista_frame.cc @@ -649,6 +649,19 @@ void VistaFrame::ProfileChanged(Profile* profile) { void VistaFrame::FocusToolbar() { } +bool VistaFrame::IsBookmarkBarVisible() const { + if (!bookmark_bar_view_.get()) + return false; + + if (bookmark_bar_view_->IsNewTabPage() || bookmark_bar_view_->IsAnimating()) + return true; + + CSize sz; + bookmark_bar_view_->GetPreferredSize(&sz); + // 1 is the minimum in GetPreferredSize for the bookmark bar. + return sz.cy > 1; +} + //////////////////////////////////////////////////////////////////////////////// // // Events diff --git a/chrome/browser/vista_frame.h b/chrome/browser/vista_frame.h index 22656af..d913b6e 100644 --- a/chrome/browser/vista_frame.h +++ b/chrome/browser/vista_frame.h @@ -184,6 +184,7 @@ class VistaFrame : public BrowserWindow, virtual void UpdateToolbar(TabContents* contents, bool should_restore_state); virtual void ProfileChanged(Profile* profile); virtual void FocusToolbar(); + virtual bool IsBookmarkBarVisible() const; //////////////////////////////////////////////////////////////////////////////// // ChromeViews::ViewContainer diff --git a/chrome/browser/xp_frame.cc b/chrome/browser/xp_frame.cc index fee785b..908f699 100644 --- a/chrome/browser/xp_frame.cc +++ b/chrome/browser/xp_frame.cc @@ -1890,6 +1890,19 @@ void XPFrame::FocusToolbar() { browser_view_->FocusToolbar(); } +bool XPFrame::IsBookmarkBarVisible() const { + if (!bookmark_bar_view_.get()) + return false; + + if (bookmark_bar_view_->IsNewTabPage() || bookmark_bar_view_->IsAnimating()) + return true; + + CSize sz; + bookmark_bar_view_->GetPreferredSize(&sz); + // 1 is the minimum in GetPreferredSize for the bookmark bar. + return sz.cy > 1; +} + void XPFrame::MoveToFront(bool should_activate) { int flags = SWP_NOMOVE | SWP_NOSIZE; if (!should_activate) { diff --git a/chrome/browser/xp_frame.h b/chrome/browser/xp_frame.h index f7960b7..622a65f 100644 --- a/chrome/browser/xp_frame.h +++ b/chrome/browser/xp_frame.h @@ -93,6 +93,7 @@ class XPFrame : public BrowserWindow, virtual void UpdateToolbar(TabContents* contents, bool should_restore_state); virtual void ProfileChanged(Profile* profile); virtual void FocusToolbar(); + virtual bool IsBookmarkBarVisible() const; // // CWindowImpl event management magic. See atlcrack.h |