OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_VIEWS_FRAME_CONTENTS_CONTAINER_H_ |
| 6 #define CHROME_BROWSER_VIEWS_FRAME_CONTENTS_CONTAINER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "views/view.h" |
| 10 |
| 11 class BrowserView; |
| 12 class TabContents; |
| 13 |
| 14 namespace views { |
| 15 class Widget; |
| 16 } |
| 17 |
| 18 // ContentsContainer is responsible for managing the TabContents views. |
| 19 // ContentsContainer has up to two children: one for the currently active |
| 20 // TabContents and one for the match preview TabContents. |
| 21 class ContentsContainer : public views::View { |
| 22 public: |
| 23 ContentsContainer(BrowserView* browser_view, views::View* active); |
| 24 virtual ~ContentsContainer(); |
| 25 |
| 26 // Makes the preview view the active view and nulls out the old active view. |
| 27 // It's assumed the caller will delete or remove the old active view |
| 28 // separately. |
| 29 void MakePreviewContentsActiveContents(); |
| 30 |
| 31 // Sets the preview view. This does not delete the old. |
| 32 void SetPreview(views::View* preview, TabContents* preview_tab_contents); |
| 33 |
| 34 TabContents* preview_tab_contents() const { return preview_tab_contents_; } |
| 35 |
| 36 // Sets the active top margin. |
| 37 void SetActiveTopMargin(int margin); |
| 38 |
| 39 // View overrides: |
| 40 virtual void Layout(); |
| 41 |
| 42 private: |
| 43 #if defined(OS_WIN) |
| 44 class TearWindow; |
| 45 #else |
| 46 typedef views::Widget TearWindow; |
| 47 #endif |
| 48 |
| 49 // Creates and configures the tear window. |
| 50 void CreateTearWindow(); |
| 51 |
| 52 // Creates and returns a new TearWindow. |
| 53 TearWindow* CreateTearWindowImpl(); |
| 54 |
| 55 // Resets the bounds of the tear window. |
| 56 void PositionTearWindow(); |
| 57 |
| 58 // Closes and deletes the tear window. |
| 59 void DeleteTearWindow(); |
| 60 |
| 61 // Invoked when the tear window is destroyed. |
| 62 void TearWindowDestroyed(); |
| 63 |
| 64 BrowserView* browser_view_; |
| 65 |
| 66 views::View* active_; |
| 67 |
| 68 views::View* preview_; |
| 69 |
| 70 TabContents* preview_tab_contents_; |
| 71 |
| 72 // Window used to show the page tear. |
| 73 TearWindow* tear_window_; |
| 74 |
| 75 // The margin between the top and the active view. This is used to make the |
| 76 // preview overlap the bookmark bar on the new tab page. |
| 77 int active_top_margin_; |
| 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); |
| 80 }; |
| 81 |
| 82 #endif // CHROME_BROWSER_VIEWS_FRAME_CONTENTS_CONTAINER_H_ |
OLD | NEW |