Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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/views/frame/opaque_browser_frame_view.h" | 5 #include "chrome/browser/views/frame/opaque_browser_frame_view.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "app/theme_provider.h" | 9 #include "app/theme_provider.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 950 // button to the screen corner to obey Fitts' Law. | 950 // button to the screen corner to obey Fitts' Law. |
| 951 int right_extra_width = is_maximized ? | 951 int right_extra_width = is_maximized ? |
| 952 (kFrameBorderThickness - kFrameShadowThickness) : 0; | 952 (kFrameBorderThickness - kFrameShadowThickness) : 0; |
| 953 gfx::Size close_button_size = close_button_->GetPreferredSize(); | 953 gfx::Size close_button_size = close_button_->GetPreferredSize(); |
| 954 close_button_->SetBounds(width() - FrameBorderThickness() - | 954 close_button_->SetBounds(width() - FrameBorderThickness() - |
| 955 right_extra_width - close_button_size.width(), caption_y, | 955 right_extra_width - close_button_size.width(), caption_y, |
| 956 close_button_size.width() + right_extra_width, | 956 close_button_size.width() + right_extra_width, |
| 957 close_button_size.height()); | 957 close_button_size.height()); |
| 958 | 958 |
| 959 #if defined(OS_CHROMEOS) | 959 #if defined(OS_CHROMEOS) |
| 960 minimize_button_->SetVisible(!is_maximized); | 960 if (is_maximized) { |
|
whywhat
2010/07/29 06:13:44
Do we ever have is_maximized set to false in Chrom
Dmitry Polukhin
2010/07/29 06:28:24
It looks like no but I can't be 100% sure.
| |
| 961 restore_button_->SetVisible(!is_maximized); | 961 minimize_button_->SetVisible(false); |
| 962 maximize_button_->SetVisible(!is_maximized); | 962 restore_button_->SetVisible(false); |
| 963 maximize_button_->SetVisible(false); | |
| 963 | 964 |
| 964 if (browser_view_->browser()->type() == Browser::TYPE_DEVTOOLS) | 965 if (browser_view_->browser()->type() == Browser::TYPE_DEVTOOLS) { |
| 966 close_button_->SetVisible(true); | |
| 967 minimize_button_->SetBounds(close_button_->bounds().x(), 0, 0, 0); | |
| 968 } else { | |
| 969 close_button_->SetVisible(false); | |
| 970 // Set the bounds of the minimize button so that we don't have to change | |
| 971 // other places that rely on the bounds. Put it slightly to the right | |
| 972 // of the edge of the view, so that when we remove the spacing it lines | |
| 973 // up with the edge. | |
| 974 minimize_button_->SetBounds( | |
| 975 width() - FrameBorderThickness() + kNewTabCaptionMaximizedSpacing, | |
| 976 0, 0, 0); | |
| 977 } | |
| 978 | |
| 979 return; | |
| 980 } else { | |
| 965 close_button_->SetVisible(true); | 981 close_button_->SetVisible(true); |
|
whywhat
2010/07/29 06:13:44
Shoudn't we set the rest buttons visible here too?
Dmitry Polukhin
2010/07/29 06:28:24
No, because visibility for all other buttons will
| |
| 966 else | |
| 967 close_button_->SetVisible(!is_maximized); | |
| 968 | |
| 969 if (is_maximized) { | |
| 970 // Set the bounds of the minimize button so that we don't have to change | |
| 971 // other places that rely on the bounds. Put it slightly to the right | |
| 972 // of the edge of the view, so that when we remove the spacing it lines | |
| 973 // up with the edge. | |
| 974 minimize_button_->SetBounds( | |
| 975 width() - FrameBorderThickness() + kNewTabCaptionMaximizedSpacing, 0, 0, | |
| 976 0); | |
| 977 return; | |
| 978 } | 982 } |
| 979 #endif | 983 #endif |
| 980 | 984 |
| 981 // When the window is restored, we show a maximized button; otherwise, we show | 985 // When the window is restored, we show a maximized button; otherwise, we show |
| 982 // a restore button. | 986 // a restore button. |
| 983 bool is_restored = !is_maximized && !frame_->GetWindow()->IsMinimized(); | 987 bool is_restored = !is_maximized && !frame_->GetWindow()->IsMinimized(); |
| 984 views::ImageButton* invisible_button = is_restored ? | 988 views::ImageButton* invisible_button = is_restored ? |
| 985 restore_button_ : maximize_button_; | 989 restore_button_ : maximize_button_; |
| 986 invisible_button->SetVisible(false); | 990 invisible_button->SetVisible(false); |
| 987 | 991 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1071 // static | 1075 // static |
| 1072 gfx::Rect OpaqueBrowserFrameView::GetViewBounds(views::View* src, | 1076 gfx::Rect OpaqueBrowserFrameView::GetViewBounds(views::View* src, |
| 1073 views::View* dst) { | 1077 views::View* dst) { |
| 1074 gfx::Rect bounds(src->bounds()); | 1078 gfx::Rect bounds(src->bounds()); |
| 1075 | 1079 |
| 1076 gfx::Point origin_in_dst(bounds.origin()); | 1080 gfx::Point origin_in_dst(bounds.origin()); |
| 1077 View::ConvertPointToView(src->GetParent(), dst, &origin_in_dst); | 1081 View::ConvertPointToView(src->GetParent(), dst, &origin_in_dst); |
| 1078 bounds.set_origin(origin_in_dst); | 1082 bounds.set_origin(origin_in_dst); |
| 1079 return bounds; | 1083 return bounds; |
| 1080 } | 1084 } |
| OLD | NEW |