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

Side by Side Diff: ui/aura/window.cc

Issue 9169050: aura: No shadow for transparent window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comments in #2 Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura/window.h ('k') | ui/views/widget/native_widget_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/aura/window.h" 5 #include "ui/aura/window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 35
36 } // namespace 36 } // namespace
37 37
38 Window::Window(WindowDelegate* delegate) 38 Window::Window(WindowDelegate* delegate)
39 : type_(client::WINDOW_TYPE_UNKNOWN), 39 : type_(client::WINDOW_TYPE_UNKNOWN),
40 delegate_(delegate), 40 delegate_(delegate),
41 parent_(NULL), 41 parent_(NULL),
42 transient_parent_(NULL), 42 transient_parent_(NULL),
43 id_(-1), 43 id_(-1),
44 transparent_(false),
44 user_data_(NULL), 45 user_data_(NULL),
45 stops_event_propagation_(false), 46 stops_event_propagation_(false),
46 ignore_events_(false) { 47 ignore_events_(false) {
47 } 48 }
48 49
49 Window::~Window() { 50 Window::~Window() {
50 if (layer_.get()) 51 if (layer_.get())
51 layer_->set_delegate(NULL); 52 layer_->set_delegate(NULL);
52 53
53 // Let the delegate know we're in the processing of destroying. 54 // Let the delegate know we're in the processing of destroying.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 DCHECK(transient_children_.empty()); 94 DCHECK(transient_children_.empty());
94 95
95 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroyed(this)); 96 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroyed(this));
96 } 97 }
97 98
98 void Window::Init(ui::Layer::LayerType layer_type) { 99 void Window::Init(ui::Layer::LayerType layer_type) {
99 layer_.reset(new ui::Layer(layer_type)); 100 layer_.reset(new ui::Layer(layer_type));
100 layer_->SetVisible(false); 101 layer_->SetVisible(false);
101 layer_->set_delegate(this); 102 layer_->set_delegate(this);
102 UpdateLayerName(name_); 103 UpdateLayerName(name_);
104 layer_->SetFillsBoundsOpaquely(!transparent_);
103 105
104 RootWindow::GetInstance()->WindowInitialized(this); 106 RootWindow::GetInstance()->WindowInitialized(this);
105 } 107 }
106 108
107 void Window::SetType(client::WindowType type) { 109 void Window::SetType(client::WindowType type) {
108 // Cannot change type after the window is initialized. 110 // Cannot change type after the window is initialized.
109 DCHECK(!layer()); 111 DCHECK(!layer());
110 type_ = type; 112 type_ = type;
111 } 113 }
112 114
113 void Window::SetName(const std::string& name) { 115 void Window::SetName(const std::string& name) {
114 name_ = name; 116 name_ = name;
115 117
116 if (layer()) 118 if (layer())
117 UpdateLayerName(name_); 119 UpdateLayerName(name_);
118 } 120 }
119 121
122 void Window::SetTransparent(bool transparent) {
123 // Cannot change transparent flag after the window is initialized.
124 DCHECK(!layer());
125 transparent_ = transparent;
126 }
127
120 ui::Layer* Window::AcquireLayer() { 128 ui::Layer* Window::AcquireLayer() {
121 return layer_.release(); 129 return layer_.release();
122 } 130 }
123 131
124 void Window::Show() { 132 void Window::Show() {
125 SetVisible(true); 133 SetVisible(true);
126 } 134 }
127 135
128 void Window::Hide() { 136 void Window::Hide() {
129 SetVisible(false); 137 SetVisible(false);
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 parent_->children().end(), 603 parent_->children().end(),
596 this); 604 this);
597 for (++i; i != parent_->children().end(); ++i) { 605 for (++i; i != parent_->children().end(); ++i) {
598 if ((*i)->StopsEventPropagation()) 606 if ((*i)->StopsEventPropagation())
599 return true; 607 return true;
600 } 608 }
601 return false; 609 return false;
602 } 610 }
603 611
604 } // namespace aura 612 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window.h ('k') | ui/views/widget/native_widget_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698