| 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()) { |
| 301 // Still have web contents. Allow renderer to shut down. |
| 302 // When web contents are destroyed, we will be called back again. |
| 303 panel_->OnWindowClosing(); |
| 304 return; |
| 305 } |
| 306 |
| 293 panel_->OnNativePanelClosed(); | 307 panel_->OnNativePanelClosed(); |
| 294 window_->Close(); | 308 window_->Close(); |
| 309 window_ = NULL; |
| 295 } | 310 } |
| 296 | 311 |
| 297 void PanelView::ActivatePanel() { | 312 void PanelView::ActivatePanel() { |
| 298 window_->Activate(); | 313 window_->Activate(); |
| 299 } | 314 } |
| 300 | 315 |
| 301 void PanelView::DeactivatePanel() { | 316 void PanelView::DeactivatePanel() { |
| 302 window_->Deactivate(); | 317 window_->Deactivate(); |
| 303 } | 318 } |
| 304 | 319 |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 int height = web_view_->size().height(); | 772 int height = web_view_->size().height(); |
| 758 SkRegion* region = new SkRegion; | 773 SkRegion* region = new SkRegion; |
| 759 region->op(0, 0, kResizeInsideBoundsSize, height, SkRegion::kUnion_Op); | 774 region->op(0, 0, kResizeInsideBoundsSize, height, SkRegion::kUnion_Op); |
| 760 region->op(width - kResizeInsideBoundsSize, 0, width, height, | 775 region->op(width - kResizeInsideBoundsSize, 0, width, height, |
| 761 SkRegion::kUnion_Op); | 776 SkRegion::kUnion_Op); |
| 762 region->op(0, height - kResizeInsideBoundsSize, width, height, | 777 region->op(0, height - kResizeInsideBoundsSize, width, height, |
| 763 SkRegion::kUnion_Op); | 778 SkRegion::kUnion_Op); |
| 764 web_contents->GetRenderViewHost()->GetView()->SetClickthroughRegion(region); | 779 web_contents->GetRenderViewHost()->GetView()->SetClickthroughRegion(region); |
| 765 #endif | 780 #endif |
| 766 } | 781 } |
| OLD | NEW |