| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/ui/views/extensions/shell_window_views.h" | 5 #include "chrome/browser/ui/views/extensions/shell_window_views.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/extensions/extension_host.h" | 8 #include "chrome/browser/extensions/extension_host.h" |
| 9 #include "chrome/common/extensions/extension.h" | 9 #include "chrome/common/extensions/extension.h" |
| 10 #include "ui/base/hit_test.h" | 10 #include "ui/base/hit_test.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // views::NonClientFrameView implementation. | 33 // views::NonClientFrameView implementation. |
| 34 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; | 34 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; |
| 35 virtual gfx::Rect GetWindowBoundsForClientBounds( | 35 virtual gfx::Rect GetWindowBoundsForClientBounds( |
| 36 const gfx::Rect& client_bounds) const OVERRIDE; | 36 const gfx::Rect& client_bounds) const OVERRIDE; |
| 37 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; | 37 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; |
| 38 virtual void GetWindowMask(const gfx::Size& size, | 38 virtual void GetWindowMask(const gfx::Size& size, |
| 39 gfx::Path* window_mask) OVERRIDE; | 39 gfx::Path* window_mask) OVERRIDE; |
| 40 virtual void ResetWindowControls() OVERRIDE {} | 40 virtual void ResetWindowControls() OVERRIDE {} |
| 41 virtual void UpdateWindowIcon() OVERRIDE {} | 41 virtual void UpdateWindowIcon() OVERRIDE {} |
| 42 virtual gfx::Size GetMinimumSize() OVERRIDE; | 42 virtual gfx::Size GetMinimumSize() OVERRIDE; |
| 43 virtual gfx::Size GetMaximumSize() OVERRIDE; |
| 43 | 44 |
| 44 void set_min_size(gfx::Size size) { min_size_ = size; } | 45 void set_min_size(gfx::Size size) { min_size_ = size; } |
| 46 void set_max_size(gfx::Size size) { max_size_ = size; } |
| 45 | 47 |
| 46 private: | 48 private: |
| 47 DISALLOW_COPY_AND_ASSIGN(ShellWindowFrameView); | 49 DISALLOW_COPY_AND_ASSIGN(ShellWindowFrameView); |
| 48 | 50 |
| 49 gfx::Size min_size_; | 51 gfx::Size min_size_; |
| 52 gfx::Size max_size_; |
| 50 }; | 53 }; |
| 51 | 54 |
| 52 ShellWindowFrameView::ShellWindowFrameView(): min_size_() { | 55 ShellWindowFrameView::ShellWindowFrameView(): min_size_() { |
| 53 } | 56 } |
| 54 | 57 |
| 55 ShellWindowFrameView::~ShellWindowFrameView() { | 58 ShellWindowFrameView::~ShellWindowFrameView() { |
| 56 } | 59 } |
| 57 | 60 |
| 58 gfx::Rect ShellWindowFrameView::GetBoundsForClientView() const { | 61 gfx::Rect ShellWindowFrameView::GetBoundsForClientView() const { |
| 59 return gfx::Rect(0, 0, width(), height()); | 62 return gfx::Rect(0, 0, width(), height()); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 96 |
| 94 void ShellWindowFrameView::GetWindowMask(const gfx::Size& size, | 97 void ShellWindowFrameView::GetWindowMask(const gfx::Size& size, |
| 95 gfx::Path* window_mask) { | 98 gfx::Path* window_mask) { |
| 96 // Don't touch it. | 99 // Don't touch it. |
| 97 } | 100 } |
| 98 | 101 |
| 99 gfx::Size ShellWindowFrameView::GetMinimumSize() { | 102 gfx::Size ShellWindowFrameView::GetMinimumSize() { |
| 100 return min_size_; | 103 return min_size_; |
| 101 } | 104 } |
| 102 | 105 |
| 106 gfx::Size ShellWindowFrameView::GetMaximumSize() { |
| 107 return max_size_; |
| 108 } |
| 103 | 109 |
| 104 ShellWindowViews::ShellWindowViews(ExtensionHost* host) | 110 ShellWindowViews::ShellWindowViews(ExtensionHost* host) |
| 105 : ShellWindow(host) { | 111 : ShellWindow(host) { |
| 106 host_->view()->SetContainer(this); | 112 host_->view()->SetContainer(this); |
| 107 window_ = new views::Widget; | 113 window_ = new views::Widget; |
| 108 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 114 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
| 109 params.delegate = this; | 115 params.delegate = this; |
| 110 params.remove_standard_frame = true; | 116 params.remove_standard_frame = true; |
| 111 int width = host_->extension()->launch_width(); | 117 int width = host_->extension()->launch_width(); |
| 112 int height = host_->extension()->launch_height(); | 118 int height = host_->extension()->launch_height(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 143 bool ShellWindowViews::CanMaximize() const { | 149 bool ShellWindowViews::CanMaximize() const { |
| 144 return true; | 150 return true; |
| 145 } | 151 } |
| 146 | 152 |
| 147 views::View* ShellWindowViews::GetContentsView() { | 153 views::View* ShellWindowViews::GetContentsView() { |
| 148 return host_->view(); | 154 return host_->view(); |
| 149 } | 155 } |
| 150 | 156 |
| 151 views::NonClientFrameView* ShellWindowViews::CreateNonClientFrameView() { | 157 views::NonClientFrameView* ShellWindowViews::CreateNonClientFrameView() { |
| 152 ShellWindowFrameView* frame_view = new ShellWindowFrameView(); | 158 ShellWindowFrameView* frame_view = new ShellWindowFrameView(); |
| 153 gfx::Size size(host_->extension()->launch_min_width(), | 159 gfx::Size min_size(host_->extension()->launch_min_width(), |
| 154 host_->extension()->launch_min_height()); | 160 host_->extension()->launch_min_height()); |
| 155 frame_view->set_min_size(size); | 161 gfx::Size max_size(host_->extension()->launch_max_width(), |
| 162 host_->extension()->launch_max_height()); |
| 163 frame_view->set_min_size(min_size); |
| 164 frame_view->set_max_size(max_size); |
| 156 return frame_view; | 165 return frame_view; |
| 157 } | 166 } |
| 158 | 167 |
| 159 string16 ShellWindowViews::GetWindowTitle() const { | 168 string16 ShellWindowViews::GetWindowTitle() const { |
| 160 return UTF8ToUTF16(host_->extension()->name()); | 169 return UTF8ToUTF16(host_->extension()->name()); |
| 161 } | 170 } |
| 162 | 171 |
| 163 views::Widget* ShellWindowViews::GetWidget() { | 172 views::Widget* ShellWindowViews::GetWidget() { |
| 164 return window_; | 173 return window_; |
| 165 } | 174 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 rgn->op(0, height - kResizeBorderWidth, width, height, SkRegion::kUnion_Op); | 209 rgn->op(0, height - kResizeBorderWidth, width, height, SkRegion::kUnion_Op); |
| 201 } | 210 } |
| 202 host_->render_view_host()->view()->SetClickthroughRegion(rgn); | 211 host_->render_view_host()->view()->SetClickthroughRegion(rgn); |
| 203 #endif | 212 #endif |
| 204 } | 213 } |
| 205 | 214 |
| 206 // static | 215 // static |
| 207 ShellWindow* ShellWindow::CreateShellWindow(ExtensionHost* host) { | 216 ShellWindow* ShellWindow::CreateShellWindow(ExtensionHost* host) { |
| 208 return new ShellWindowViews(host); | 217 return new ShellWindowViews(host); |
| 209 } | 218 } |
| OLD | NEW |