diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-10 22:07:09 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-10 22:07:09 +0000 |
commit | 6ecc60e234224d61cb6a5157ebbc65448e66b716 (patch) | |
tree | 2cac2b706a1ea69febdc4060d5f25f54eee4a0ae /chrome/browser/views | |
parent | 4f425554e926abb988a4949f8e93e1b0ddd1bc5f (diff) | |
download | chromium_src-6ecc60e234224d61cb6a5157ebbc65448e66b716.zip chromium_src-6ecc60e234224d61cb6a5157ebbc65448e66b716.tar.gz chromium_src-6ecc60e234224d61cb6a5157ebbc65448e66b716.tar.bz2 |
Reverting 9493.
Review URL: http://codereview.chromium.org/21231
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9517 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/download_shelf_view.cc | 8 | ||||
-rw-r--r-- | chrome/browser/views/download_shelf_view.h | 10 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 115 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.h | 5 |
4 files changed, 12 insertions, 126 deletions
diff --git a/chrome/browser/views/download_shelf_view.cc b/chrome/browser/views/download_shelf_view.cc index d4e02ed..5467be7 100644 --- a/chrome/browser/views/download_shelf_view.cc +++ b/chrome/browser/views/download_shelf_view.cc @@ -73,7 +73,7 @@ int CenterPosition(int size, int target_size) { return std::max((target_size - size) / 2, kTopBottomPadding); } -} // namespace +} // namespace DownloadShelfView::DownloadShelfView(TabContents* tab_contents) : tab_contents_(tab_contents) { @@ -207,9 +207,6 @@ void DownloadShelfView::Layout() { if (!GetWidget()) return; - // Let our base class layout our child views - views::View::Layout(); - gfx::Size image_size = arrow_image_->GetPreferredSize(); gfx::Size close_button_size = close_button_->GetPreferredSize(); gfx::Size show_all_size = show_all_view_->GetPreferredSize(); @@ -273,6 +270,3 @@ void DownloadShelfView::ButtonPressed(views::BaseButton* button) { shelf_animation_->Hide(); } -bool DownloadShelfView::IsShowing() const { - return shelf_animation_->IsShowing(); -} diff --git a/chrome/browser/views/download_shelf_view.h b/chrome/browser/views/download_shelf_view.h index 3f157a4..35213a8 100644 --- a/chrome/browser/views/download_shelf_view.h +++ b/chrome/browser/views/download_shelf_view.h @@ -31,7 +31,7 @@ class DownloadShelfView : public views::View, public views::LinkController, public AnimationDelegate { public: - explicit DownloadShelfView(TabContents* tab_contents); + DownloadShelfView(TabContents* tab_contents); // A new download has started, so add it to our shelf. void AddDownload(DownloadItem* download); @@ -68,12 +68,6 @@ class DownloadShelfView : public views::View, // one. void ChangeTabContents(TabContents* old_contents, TabContents* new_contents); - // The browser view needs to know when we are going away to properly return - // the resize corner size to WebKit so that we don't draw on top of it. - // This returns the showing state of our animation which is set to false at - // the beginning Show and true at the beginning of a Hide. - bool IsShowing() const; - private: void Init(); @@ -113,5 +107,5 @@ class DownloadShelfView : public views::View, DISALLOW_EVIL_CONSTRUCTORS(DownloadShelfView); }; -#endif // CHROME_BROWSER_VIEWS_DOWNLOAD_SHELF_VIEW_H__ +#endif // CHROME_BROWSER_VIEWS_DOWNLOAD_SHELF_VIEW_H__ diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 8ccb3e5..e57b2cc 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -47,15 +47,12 @@ #include "chrome/common/resource_bundle.h" #include "chrome/common/win_util.h" #include "chrome/views/hwnd_notification_source.h" -#include "chrome/views/native_scroll_bar.h" #include "chrome/views/non_client_view.h" #include "chrome/views/view.h" #include "chrome/views/window.h" #include "chromium_strings.h" #include "generated_resources.h" -#include "webkit_resources.h" - using base::TimeDelta; @@ -89,11 +86,7 @@ static const int kLoadingAnimationFrameTimeMs = 30; // If not -1, windows are shown with this state. static int explicit_show_state = -1; -static const struct { - bool separator; - int command; - int label; -} kMenuLayout[] = { +static const struct { bool separator; int command; int label; } kMenuLayout[] = { { true, 0, 0 }, { false, IDC_TASK_MANAGER, IDS_TASK_MANAGER }, { true, 0, 0 }, @@ -118,53 +111,6 @@ static const struct { }; /////////////////////////////////////////////////////////////////////////////// -// ResizeCorner, private: - -class ResizeCorner : public views::View { - public: - ResizeCorner() {} - virtual void Paint(ChromeCanvas* canvas) { - SkBitmap * bitmap = ResourceBundle::GetSharedInstance().GetBitmapNamed( - IDR_TEXTAREA_RESIZER); - bitmap->buildMipMap(false); - bool rtl_dir = (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT); - if (rtl_dir) { - canvas->TranslateInt(width(), 0); - canvas->ScaleInt(-1, 1); - canvas->save(); - } - canvas->DrawBitmapInt(*bitmap, width() - bitmap->width(), - height() - bitmap->height()); - if (rtl_dir) - canvas->restore(); - } - - static gfx::Size GetSize() { - return gfx::Size(views::NativeScrollBar::GetVerticalScrollBarWidth(), - views::NativeScrollBar::GetHorizontalScrollBarHeight()); - } - - virtual gfx::Size GetPreferredSize() { - return GetSize(); - } - - virtual void Layout() { - views::View* parent_view = GetParent(); - if (parent_view) { - gfx::Size ps = GetPreferredSize(); - // No need to handle Right to left text direction here, - // our parent must take care of it for us... - SetBounds(parent_view->width() - ps.width(), - parent_view->height() - ps.height(), ps.width(), ps.height()); - } - } - - private: - DISALLOW_COPY_AND_ASSIGN(ResizeCorner); -}; - - -/////////////////////////////////////////////////////////////////////////////// // BrowserView, public: // static @@ -173,7 +119,7 @@ void BrowserView::SetShowState(int state) { } BrowserView::BrowserView(Browser* browser) - : views::ClientView(NULL, NULL), + : ClientView(NULL, NULL), frame_(NULL), browser_(browser), active_bookmark_bar_(NULL), @@ -231,7 +177,7 @@ void BrowserView::WindowMoved() { // Cancel any tabstrip animations, some of them may be invalidated by the // window being repositioned. // Comment out for one cycle to see if this fixes dist tests. - // tabstrip_->DestroyDragController(); + //tabstrip_->DestroyDragController(); status_bubble_->Reposition(); @@ -545,7 +491,7 @@ gfx::Rect BrowserView::GetNormalBounds() const { return gfx::Rect(wp.rcNormalPosition); } -bool BrowserView::IsMaximized() const { +bool BrowserView::IsMaximized() { return frame_->GetWindow()->IsMaximized(); } @@ -589,32 +535,6 @@ bool BrowserView::IsBookmarkBarVisible() const { return bookmark_bar_view_->GetPreferredSize().height() > 1; } -gfx::Rect BrowserView::GetRootWindowResizerRect() const { - // There is no resize corner when we are maximized - if (IsMaximized()) - return gfx::Rect(); - - // We don't specify a resize corner size if we have a bottom shelf either. - // This is because we take care of drawing the resize corner on top of that - // shelf, so we don't want others to do it for us in this case. - // Currently, the only visible bottom shelf is the download shelf. - // Other tests should be added here if we add more bottom shelves. - TabContents* current_tab = browser_->GetSelectedTabContents(); - if (current_tab && current_tab->IsDownloadShelfVisible()) { - DownloadShelfView* download_shelf = current_tab->GetDownloadShelfView(); - if (download_shelf && download_shelf->IsShowing()) - return gfx::Rect(); - } - - gfx::Rect client_rect = contents_container_->bounds(); - gfx::Size resize_corner_size = ResizeCorner::GetSize(); - int x = client_rect.width() - resize_corner_size.width(); - if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) - x = 0; - return gfx::Rect(x, client_rect.height() - resize_corner_size.height(), - resize_corner_size.width(), resize_corner_size.height()); -} - void BrowserView::ToggleBookmarkBar() { BookmarkBarView::ToggleWhenVisible(browser_->profile()); } @@ -967,24 +887,6 @@ int BrowserView::NonClientHitTest(const gfx::Point& point) { // area of the window. So we need to treat hit-tests in these regions as // hit-tests of the titlebar. - // There is not resize corner when we are maximised - if (!IsMaximized()) { - CRect client_rect; - ::GetClientRect(frame_->GetWindow()->GetHWND(), &client_rect); - gfx::Size resize_corner_size = ResizeCorner::GetSize(); - gfx::Rect resize_corner_rect(client_rect.right - resize_corner_size.width(), - client_rect.bottom - resize_corner_size.height(), - resize_corner_size.width(), resize_corner_size.height()); - bool rtl_dir = (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT); - if (rtl_dir) - resize_corner_rect.set_x(0); - if (resize_corner_rect.Contains(point)) { - if (rtl_dir) - return HTBOTTOMLEFT; - return HTBOTTOMRIGHT; - } - } - // Determine if the TabStrip exists and is capable of being clicked on. We // might be a popup window without a TabStrip, or the TabStrip could be // animating. @@ -1038,7 +940,7 @@ int BrowserView::NonClientHitTest(const gfx::Point& point) { return HTNOWHERE; // If the point is somewhere else, delegate to the default implementation. - return views::ClientView::NonClientHitTest(point); + return ClientView::NonClientHitTest(point); } /////////////////////////////////////////////////////////////////////////////// @@ -1217,7 +1119,7 @@ int BrowserView::LayoutBookmarkAndInfoBars(int top) { return LayoutBookmarkBar(top); } - // If we're showing a regular bookmark bar and it's not below an infobar, + // If we're showing a regular bookmark bar and it's not below an infobar, // make it overlap the toolbar so that the bar items can be drawn higher. if (active_bookmark_bar_) top -= bookmark_bar_view_->GetToolbarOverlap(); @@ -1298,11 +1200,8 @@ bool BrowserView::MaybeShowInfoBar(TabContents* contents) { bool BrowserView::MaybeShowDownloadShelf(TabContents* contents) { views::View* new_shelf = NULL; - if (contents && contents->IsDownloadShelfVisible()) { + if (contents && contents->IsDownloadShelfVisible()) new_shelf = contents->GetDownloadShelfView(); - if (new_shelf != active_download_shelf_) - new_shelf->AddChildView(new ResizeCorner()); - } return UpdateChildViewAndLayout(new_shelf, &active_download_shelf_); } diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index ba247c9..7be0501 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -172,14 +172,13 @@ class BrowserView : public BrowserWindow, virtual void UpdateLoadingAnimations(bool should_animate); virtual void SetStarredState(bool is_starred); virtual gfx::Rect GetNormalBounds() const; - virtual bool IsMaximized() const; + virtual bool IsMaximized(); virtual LocationBar* GetLocationBar() const; virtual void UpdateStopGoState(bool is_loading); virtual void UpdateToolbar(TabContents* contents, bool should_restore_state); virtual void FocusToolbar(); virtual void DestroyBrowser(); virtual bool IsBookmarkBarVisible() const; - virtual gfx::Rect GetRootWindowResizerRect() const; virtual void ToggleBookmarkBar(); virtual void ShowAboutChromeDialog(); virtual void ShowBookmarkManager(); @@ -429,4 +428,4 @@ class BrowserView : public BrowserWindow, DISALLOW_EVIL_CONSTRUCTORS(BrowserView); }; -#endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_H_ +#endif // #ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_H_ |