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

Side by Side Diff: ash/wm/workspace/phantom_window_controller.cc

Issue 10827205: ash: Add a NULL-check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « no previous file | no next file » | 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 "ash/wm/workspace/phantom_window_controller.h" 5 #include "ash/wm/workspace/phantom_window_controller.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/wm/coordinate_conversion.h" 9 #include "ash/wm/coordinate_conversion.h"
10 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 100
101 void PhantomWindowController::SetBounds(const gfx::Rect& bounds) { 101 void PhantomWindowController::SetBounds(const gfx::Rect& bounds) {
102 DCHECK(IsShowing()); 102 DCHECK(IsShowing());
103 animation_.reset(); 103 animation_.reset();
104 bounds_ = bounds; 104 bounds_ = bounds;
105 phantom_widget_->SetBounds(bounds_); 105 phantom_widget_->SetBounds(bounds_);
106 } 106 }
107 107
108 void PhantomWindowController::Hide() { 108 void PhantomWindowController::Hide() {
109 phantom_widget_->Close(); 109 if (phantom_widget_)
110 phantom_widget_->Close();
110 phantom_widget_ = NULL; 111 phantom_widget_ = NULL;
111 } 112 }
112 113
113 bool PhantomWindowController::IsShowing() const { 114 bool PhantomWindowController::IsShowing() const {
114 return phantom_widget_ != NULL; 115 return phantom_widget_ != NULL;
115 } 116 }
116 117
117 void PhantomWindowController::AnimationProgressed( 118 void PhantomWindowController::AnimationProgressed(
118 const ui::Animation* animation) { 119 const ui::Animation* animation) {
119 phantom_widget_->SetBounds( 120 phantom_widget_->SetBounds(
(...skipping 28 matching lines...) Expand all
148 phantom_widget_->Show(); 149 phantom_widget_->Show();
149 // Fade the window in. 150 // Fade the window in.
150 ui::Layer* layer = phantom_widget_->GetNativeWindow()->layer(); 151 ui::Layer* layer = phantom_widget_->GetNativeWindow()->layer();
151 layer->SetOpacity(0); 152 layer->SetOpacity(0);
152 ui::ScopedLayerAnimationSettings scoped_setter(layer->GetAnimator()); 153 ui::ScopedLayerAnimationSettings scoped_setter(layer->GetAnimator());
153 layer->SetOpacity(1); 154 layer->SetOpacity(1);
154 } 155 }
155 156
156 } // namespace internal 157 } // namespace internal
157 } // namespace ash 158 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698