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

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

Issue 8741018: Revert 112232 - Added hotkey support to 8508009 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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/aura_shell/desktop_background_view.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 STLDeleteElements(&transient_children); 71 STLDeleteElements(&transient_children);
72 DCHECK(transient_children_.empty()); 72 DCHECK(transient_children_.empty());
73 73
74 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroyed(this)); 74 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroyed(this));
75 } 75 }
76 76
77 void Window::Init(ui::Layer::LayerType layer_type) { 77 void Window::Init(ui::Layer::LayerType layer_type) {
78 layer_.reset(new ui::Layer(layer_type)); 78 layer_.reset(new ui::Layer(layer_type));
79 layer_->SetVisible(false); 79 layer_->SetVisible(false);
80 layer_->set_delegate(this); 80 layer_->set_delegate(this);
81 UpdateLayerName(name_); 81
82 #if !defined(NDEBUG)
83 std::string layer_name(name_);
84 if (layer_name.empty())
85 layer_name.append("Unnamed Window");
86
87 if (id_ != -1) {
88 char id_buf[10];
89 base::snprintf(id_buf, sizeof(id_buf), " %d", id_);
90 layer_name.append(id_buf);
91 }
92 layer_->set_name(layer_name);
93 #endif
82 94
83 Desktop::GetInstance()->WindowInitialized(this); 95 Desktop::GetInstance()->WindowInitialized(this);
84 } 96 }
85 97
86 void Window::SetType(WindowType type) { 98 void Window::SetType(WindowType type) {
87 // Cannot change type after the window is initialized. 99 // Cannot change type after the window is initialized.
88 DCHECK(!layer()); 100 DCHECK(!layer());
89 type_ = type; 101 type_ = type;
90 } 102 }
91 103
92 void Window::SetName(const std::string& name) {
93 name_ = name;
94
95 if (layer())
96 UpdateLayerName(name_);
97 }
98
99 void Window::Show() { 104 void Window::Show() {
100 SetVisible(true); 105 SetVisible(true);
101 } 106 }
102 107
103 void Window::Hide() { 108 void Window::Hide() {
104 SetVisible(false); 109 SetVisible(false);
105 ReleaseCapture(); 110 ReleaseCapture();
106 if (Desktop::GetInstance()->active_window() == this || 111 if (Desktop::GetInstance()->active_window() == this ||
107 !Desktop::GetInstance()->active_window()) { 112 !Desktop::GetInstance()->active_window()) {
108 Desktop::GetInstance()->ActivateTopmostWindow(); 113 Desktop::GetInstance()->ActivateTopmostWindow();
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 536
532 void Window::OnStackingChanged() { 537 void Window::OnStackingChanged() {
533 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowStackingChanged(this)); 538 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowStackingChanged(this));
534 } 539 }
535 540
536 void Window::OnPaintLayer(gfx::Canvas* canvas) { 541 void Window::OnPaintLayer(gfx::Canvas* canvas) {
537 if (delegate_) 542 if (delegate_)
538 delegate_->OnPaint(canvas); 543 delegate_->OnPaint(canvas);
539 } 544 }
540 545
541 void Window::UpdateLayerName(const std::string& name) {
542 #if !defined(NDEBUG)
543 DCHECK(layer());
544
545 std::string layer_name(name_);
546 if (layer_name.empty())
547 layer_name.append("Unnamed Window");
548
549 if (id_ != -1) {
550 char id_buf[10];
551 base::snprintf(id_buf, sizeof(id_buf), " %d", id_);
552 layer_name.append(id_buf);
553 }
554 layer()->set_name(layer_name);
555 #endif
556 }
557
558 } // namespace aura 546 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window.h ('k') | ui/aura_shell/desktop_background_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698