Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "chrome/browser/ui/panels/panel_view.h" | 5 #include "chrome/browser/ui/panels/panel_view.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 panel_->manager()->OnPanelAnimationEnded(panel_.get()); | 279 panel_->manager()->OnPanelAnimationEnded(panel_.get()); |
| 280 } | 280 } |
| 281 | 281 |
| 282 void PanelView::AnimationProgressed(const ui::Animation* animation) { | 282 void PanelView::AnimationProgressed(const ui::Animation* animation) { |
| 283 gfx::Rect new_bounds = bounds_animator_->CurrentValueBetween( | 283 gfx::Rect new_bounds = bounds_animator_->CurrentValueBetween( |
| 284 animation_start_bounds_, bounds_); | 284 animation_start_bounds_, bounds_); |
| 285 GetWidget()->SetBounds(new_bounds); | 285 GetWidget()->SetBounds(new_bounds); |
| 286 } | 286 } |
| 287 | 287 |
| 288 void PanelView::ClosePanel() { | 288 void PanelView::ClosePanel() { |
| 289 // We're already closing. Do nothing. | |
| 290 if (!window_) | |
| 291 return; | |
| 292 | |
| 293 if (!panel_->ShouldCloseWindow()) | |
| 294 return; | |
| 295 | |
| 289 // Cancel any currently running animation since we're closing down. | 296 // Cancel any currently running animation since we're closing down. |
| 290 if (bounds_animator_.get()) | 297 if (bounds_animator_.get()) |
| 291 bounds_animator_.reset(); | 298 bounds_animator_.reset(); |
| 292 | 299 |
| 300 if (panel_->GetWebContents()) { | |
|
jianli
2012/09/19 01:09:43
nit: could you please add comment for why we need
jennb
2012/09/19 01:16:46
Done. Stole wording from browser_view.cc
| |
| 301 // When web contents are destroyed, we will be called back again. | |
| 302 panel_->OnWindowClosing(); | |
| 303 return; | |
| 304 } | |
| 305 | |
| 293 panel_->OnNativePanelClosed(); | 306 panel_->OnNativePanelClosed(); |
| 294 window_->Close(); | 307 window_->Close(); |
| 308 window_ = NULL; | |
| 295 } | 309 } |
| 296 | 310 |
| 297 void PanelView::ActivatePanel() { | 311 void PanelView::ActivatePanel() { |
| 298 window_->Activate(); | 312 window_->Activate(); |
| 299 } | 313 } |
| 300 | 314 |
| 301 void PanelView::DeactivatePanel() { | 315 void PanelView::DeactivatePanel() { |
| 302 window_->Deactivate(); | 316 window_->Deactivate(); |
| 303 } | 317 } |
| 304 | 318 |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 757 int height = web_view_->size().height(); | 771 int height = web_view_->size().height(); |
| 758 SkRegion* region = new SkRegion; | 772 SkRegion* region = new SkRegion; |
| 759 region->op(0, 0, kResizeInsideBoundsSize, height, SkRegion::kUnion_Op); | 773 region->op(0, 0, kResizeInsideBoundsSize, height, SkRegion::kUnion_Op); |
| 760 region->op(width - kResizeInsideBoundsSize, 0, width, height, | 774 region->op(width - kResizeInsideBoundsSize, 0, width, height, |
| 761 SkRegion::kUnion_Op); | 775 SkRegion::kUnion_Op); |
| 762 region->op(0, height - kResizeInsideBoundsSize, width, height, | 776 region->op(0, height - kResizeInsideBoundsSize, width, height, |
| 763 SkRegion::kUnion_Op); | 777 SkRegion::kUnion_Op); |
| 764 web_contents->GetRenderViewHost()->GetView()->SetClickthroughRegion(region); | 778 web_contents->GetRenderViewHost()->GetView()->SetClickthroughRegion(region); |
| 765 #endif | 779 #endif |
| 766 } | 780 } |
| OLD | NEW |