| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 // ContentsContainer is responsible for managing the active WebContents view. | 26 // ContentsContainer is responsible for managing the active WebContents view. |
| 27 // ContentsContainer has one child: the currently active WebContents. | 27 // ContentsContainer has one child: the currently active WebContents. |
| 28 // TODO(kuan): Remove ContentsContainer since it has only one child now - | 28 // TODO(kuan): Remove ContentsContainer since it has only one child now - |
| 29 // http://crbug.com/236587. | 29 // http://crbug.com/236587. |
| 30 class ContentsContainer : public views::View { | 30 class ContentsContainer : public views::View { |
| 31 public: | 31 public: |
| 32 // Internal class name | 32 // Internal class name |
| 33 static const char kViewClassName[]; | 33 static const char kViewClassName[]; |
| 34 | 34 |
| 35 explicit ContentsContainer(views::WebView* active); | 35 explicit ContentsContainer(views::View* active); |
| 36 virtual ~ContentsContainer(); | 36 virtual ~ContentsContainer(); |
| 37 | 37 |
| 38 // Makes the overlay view the active view and nulls out the old active view. | 38 // Makes the overlay view the active view and nulls out the old active view. |
| 39 // The caller must delete or remove the old active view separately. | 39 // The caller must delete or remove the old active view separately. |
| 40 // Called after |overlay| has been reparented to |ContentsContainer|. | 40 // Called after |overlay| has been reparented to |ContentsContainer|. |
| 41 void SetActive(views::WebView* overlay); | 41 void SetActive(views::WebView* overlay); |
| 42 | 42 |
| 43 // Sets the active top margin; the active WebView's y origin would be | 43 // Sets the active top margin; the active WebView's y origin would be |
| 44 // positioned at this |margin|, causing the active WebView to be pushed down | 44 // positioned at this |margin|, causing the active WebView to be pushed down |
| 45 // vertically by |margin| pixels in the |ContentsContainer|. Returns true | 45 // vertically by |margin| pixels in the |ContentsContainer|. Returns true |
| 46 // if the margin changed and this view needs Layout(). | 46 // if the margin changed and this view needs Layout(). |
| 47 bool SetActiveTopMargin(int margin); | 47 bool SetActiveTopMargin(int margin); |
| 48 | 48 |
| 49 // Overridden from views::View: | 49 // Overridden from views::View: |
| 50 virtual void Layout() OVERRIDE; | 50 virtual void Layout() OVERRIDE; |
| 51 virtual const char* GetClassName() const OVERRIDE; | 51 virtual const char* GetClassName() const OVERRIDE; |
| 52 | 52 |
| 53 // Testing interface: | 53 // Testing interface: |
| 54 views::WebView* GetActiveWebViewForTest() { return active_; } | 54 views::View* GetActiveWebViewForTest() { return active_; } |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 views::WebView* active_; | 57 views::View* active_; |
| 58 | 58 |
| 59 // The margin between the top and the active view. This is used to make the | 59 // The margin between the top and the active view. This is used to make the |
| 60 // overlay overlap the bookmark bar on the new tab page. | 60 // overlay overlap the bookmark bar on the new tab page. |
| 61 int active_top_margin_; | 61 int active_top_margin_; |
| 62 | 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); | 63 DISALLOW_COPY_AND_ASSIGN(ContentsContainer); |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ | 66 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ |
| OLD | NEW |