Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: ui/views/window/client_view.cc

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/window/client_view.h ('k') | ui/views/window/custom_frame_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/views/window/client_view.h"
6
7 #include "base/logging.h"
8 #include "ui/accessibility/ax_view_state.h"
9 #include "ui/base/hit_test.h"
10 #include "ui/views/widget/widget.h"
11 #include "ui/views/widget/widget_delegate.h"
12
13 namespace views {
14
15 // static
16 const char ClientView::kViewClassName[] =
17 "ui/views/window/ClientView";
18
19 ///////////////////////////////////////////////////////////////////////////////
20 // ClientView, public:
21
22 ClientView::ClientView(Widget* widget, View* contents_view)
23 : contents_view_(contents_view) {
24 }
25
26 int ClientView::NonClientHitTest(const gfx::Point& point) {
27 return bounds().Contains(point) ? HTCLIENT : HTNOWHERE;
28 }
29
30 DialogClientView* ClientView::AsDialogClientView() {
31 return NULL;
32 }
33
34 const DialogClientView* ClientView::AsDialogClientView() const {
35 return NULL;
36 }
37
38 bool ClientView::CanClose() {
39 return true;
40 }
41
42 void ClientView::WidgetClosing() {
43 }
44
45 ///////////////////////////////////////////////////////////////////////////////
46 // ClientView, View overrides:
47
48 gfx::Size ClientView::GetPreferredSize() const {
49 // |contents_view_| is allowed to be NULL up until the point where this view
50 // is attached to a Container.
51 return contents_view_ ? contents_view_->GetPreferredSize() : gfx::Size();
52 }
53
54 gfx::Size ClientView::GetMaximumSize() const {
55 // |contents_view_| is allowed to be NULL up until the point where this view
56 // is attached to a Container.
57 return contents_view_ ? contents_view_->GetMaximumSize() : gfx::Size();
58 }
59
60 gfx::Size ClientView::GetMinimumSize() const {
61 // |contents_view_| is allowed to be NULL up until the point where this view
62 // is attached to a Container.
63 return contents_view_ ? contents_view_->GetMinimumSize() : gfx::Size();
64 }
65
66 void ClientView::Layout() {
67 // |contents_view_| is allowed to be NULL up until the point where this view
68 // is attached to a Container.
69 if (contents_view_)
70 contents_view_->SetBounds(0, 0, width(), height());
71 }
72
73 const char* ClientView::GetClassName() const {
74 return kViewClassName;
75 }
76
77 void ClientView::GetAccessibleState(ui::AXViewState* state) {
78 state->role = ui::AX_ROLE_CLIENT;
79 }
80
81 void ClientView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
82 // Overridden to do nothing. The NonClientView manually calls Layout on the
83 // ClientView when it is itself laid out, see comment in
84 // NonClientView::Layout.
85 }
86
87 void ClientView::ViewHierarchyChanged(
88 const ViewHierarchyChangedDetails& details) {
89 if (details.is_add && details.child == this) {
90 DCHECK(GetWidget());
91 DCHECK(contents_view_); // |contents_view_| must be valid now!
92 // Insert |contents_view_| at index 0 so it is first in the focus chain.
93 // (the OK/Cancel buttons are inserted before contents_view_)
94 AddChildViewAt(contents_view_, 0);
95 }
96 }
97
98 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/window/client_view.h ('k') | ui/views/window/custom_frame_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698