OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/frame/browser_non_client_frame_view_mus.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "chrome/browser/profiles/profiles_state.h" | 9 #include "chrome/browser/profiles/profiles_state.h" |
10 #include "chrome/browser/themes/theme_properties.h" | 10 #include "chrome/browser/themes/theme_properties.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 // clicks in the frame decoration. | 219 // clicks in the frame decoration. |
220 static_cast<aura::WindowTreeHostMus*>( | 220 static_cast<aura::WindowTreeHostMus*>( |
221 reveal_widget->GetNativeWindow()->GetHost()) | 221 reveal_widget->GetNativeWindow()->GetHost()) |
222 ->SetClientArea(client_area_insets, additional_client_area); | 222 ->SetClientArea(client_area_insets, additional_client_area); |
223 } | 223 } |
224 } else { | 224 } else { |
225 window_tree_host_mus->SetClientArea(gfx::Insets(), additional_client_area); | 225 window_tree_host_mus->SetClientArea(gfx::Insets(), additional_client_area); |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 void BrowserNonClientFrameViewMus::UpdateMinimumSize() { | |
230 gfx::Size min_size = GetMinimumSize(); | |
231 aura::Window* frame_window = frame()->GetNativeWindow(); | |
232 const gfx::Size* previous_min_size = | |
233 frame_window->GetProperty(aura::client::kMinimumSize); | |
234 if (!previous_min_size || *previous_min_size != min_size) { | |
235 frame_window->SetProperty(aura::client::kMinimumSize, | |
236 new gfx::Size(min_size)); | |
237 } | |
238 } | |
239 | |
229 /////////////////////////////////////////////////////////////////////////////// | 240 /////////////////////////////////////////////////////////////////////////////// |
230 // views::NonClientFrameView: | 241 // views::NonClientFrameView: |
231 | 242 |
232 gfx::Rect BrowserNonClientFrameViewMus::GetBoundsForClientView() const { | 243 gfx::Rect BrowserNonClientFrameViewMus::GetBoundsForClientView() const { |
233 // The ClientView must be flush with the top edge of the widget so that the | 244 // The ClientView must be flush with the top edge of the widget so that the |
234 // web contents can take up the entire screen in immersive fullscreen (with | 245 // web contents can take up the entire screen in immersive fullscreen (with |
235 // or without the top-of-window views revealed). When in immersive fullscreen | 246 // or without the top-of-window views revealed). When in immersive fullscreen |
236 // and the top-of-window views are revealed, the TopContainerView paints the | 247 // and the top-of-window views are revealed, the TopContainerView paints the |
237 // window header by redirecting paints from its background to | 248 // window header by redirecting paints from its background to |
238 // BrowserNonClientFrameViewMus. | 249 // BrowserNonClientFrameViewMus. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 int min_width = std::max(min_frame_width, min_client_view_size.width()); | 340 int min_width = std::max(min_frame_width, min_client_view_size.width()); |
330 if (browser_view()->IsTabStripVisible()) { | 341 if (browser_view()->IsTabStripVisible()) { |
331 // Ensure that the minimum width is enough to hold a minimum width tab strip | 342 // Ensure that the minimum width is enough to hold a minimum width tab strip |
332 // at its usual insets. | 343 // at its usual insets. |
333 int min_tabstrip_width = | 344 int min_tabstrip_width = |
334 browser_view()->tabstrip()->GetMinimumSize().width(); | 345 browser_view()->tabstrip()->GetMinimumSize().width(); |
335 min_width = | 346 min_width = |
336 std::max(min_width, min_tabstrip_width + GetTabStripLeftInset() + | 347 std::max(min_width, min_tabstrip_width + GetTabStripLeftInset() + |
337 GetTabStripRightInset()); | 348 GetTabStripRightInset()); |
338 } | 349 } |
339 return gfx::Size(min_width, min_client_view_size.height()); | 350 gfx::Size min_size(min_width, min_client_view_size.height()); |
sky
2017/06/22 03:41:10
Convert back to old code as there is no reason for
varkha
2017/06/22 17:50:14
Done.
| |
351 return min_size; | |
340 } | 352 } |
341 | 353 |
342 /////////////////////////////////////////////////////////////////////////////// | 354 /////////////////////////////////////////////////////////////////////////////// |
343 // TabIconViewModel: | 355 // TabIconViewModel: |
344 | 356 |
345 bool BrowserNonClientFrameViewMus::ShouldTabIconViewAnimate() const { | 357 bool BrowserNonClientFrameViewMus::ShouldTabIconViewAnimate() const { |
346 // This function is queried during the creation of the window as the | 358 // This function is queried during the creation of the window as the |
347 // TabIconView we host is initialized, so we need to null check the selected | 359 // TabIconView we host is initialized, so we need to null check the selected |
348 // WebContents because in this condition there is not yet a selected tab. | 360 // WebContents because in this condition there is not yet a selected tab. |
349 content::WebContents* current_tab = browser_view()->GetActiveWebContents(); | 361 content::WebContents* current_tab = browser_view()->GetActiveWebContents(); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
516 // TODO: move ash_layout_constants to ash/public/cpp. | 528 // TODO: move ash_layout_constants to ash/public/cpp. |
517 const bool restored = !frame()->IsMaximized() && !frame()->IsFullscreen(); | 529 const bool restored = !frame()->IsMaximized() && !frame()->IsFullscreen(); |
518 return GetAshLayoutSize(restored | 530 return GetAshLayoutSize(restored |
519 ? AshLayoutSize::BROWSER_RESTORED_CAPTION_BUTTON | 531 ? AshLayoutSize::BROWSER_RESTORED_CAPTION_BUTTON |
520 : AshLayoutSize::BROWSER_MAXIMIZED_CAPTION_BUTTON) | 532 : AshLayoutSize::BROWSER_MAXIMIZED_CAPTION_BUTTON) |
521 .height(); | 533 .height(); |
522 #else | 534 #else |
523 return views::WindowManagerFrameValues::instance().normal_insets.top(); | 535 return views::WindowManagerFrameValues::instance().normal_insets.top(); |
524 #endif | 536 #endif |
525 } | 537 } |
OLD | NEW |