| OLD | NEW |
| 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/views/widget/native_widget_aura.h" | 5 #include "ui/views/widget/native_widget_aura.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "ui/aura/client/activation_client.h" | 9 #include "ui/aura/client/activation_client.h" |
| 10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 delegate_->OnNativeWidgetSizeChanged(params.bounds.size()); | 177 delegate_->OnNativeWidgetSizeChanged(params.bounds.size()); |
| 178 can_activate_ = params.can_activate; | 178 can_activate_ = params.can_activate; |
| 179 DCHECK(GetWidget()->GetRootView()); | 179 DCHECK(GetWidget()->GetRootView()); |
| 180 if (params.type != Widget::InitParams::TYPE_TOOLTIP) { | 180 if (params.type != Widget::InitParams::TYPE_TOOLTIP) { |
| 181 tooltip_manager_.reset(new views::TooltipManagerAura(this)); | 181 tooltip_manager_.reset(new views::TooltipManagerAura(this)); |
| 182 } | 182 } |
| 183 | 183 |
| 184 drop_helper_.reset(new DropHelper(GetWidget()->GetRootView())); | 184 drop_helper_.reset(new DropHelper(GetWidget()->GetRootView())); |
| 185 if (params.type != Widget::InitParams::TYPE_TOOLTIP && | 185 if (params.type != Widget::InitParams::TYPE_TOOLTIP && |
| 186 params.type != Widget::InitParams::TYPE_POPUP) { | 186 params.type != Widget::InitParams::TYPE_POPUP) { |
| 187 window_->SetProperty(aura::kDragDropDelegateKey, | 187 aura::client::SetDragDropDelegate(window_, this); |
| 188 static_cast<aura::WindowDragDropDelegate*>(this)); | |
| 189 } | 188 } |
| 190 | 189 |
| 191 aura::ActivationDelegate::SetActivationDelegate(window_, this); | 190 aura::ActivationDelegate::SetActivationDelegate(window_, this); |
| 192 | 191 |
| 193 if (window_type == Widget::InitParams::TYPE_MENU || | 192 if (window_type == Widget::InitParams::TYPE_MENU || |
| 194 window_type == Widget::InitParams::TYPE_TOOLTIP) | 193 window_type == Widget::InitParams::TYPE_TOOLTIP) |
| 195 window_->SetIntProperty(aura::kShadowTypeKey, | 194 window_->SetIntProperty(aura::kShadowTypeKey, |
| 196 aura::SHADOW_TYPE_RECTANGULAR); | 195 aura::SHADOW_TYPE_RECTANGULAR); |
| 197 } | 196 } |
| 198 | 197 |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 | 502 |
| 504 bool NativeWidgetAura::IsAccessibleWidget() const { | 503 bool NativeWidgetAura::IsAccessibleWidget() const { |
| 505 // http://crbug.com/102570 | 504 // http://crbug.com/102570 |
| 506 //NOTIMPLEMENTED(); | 505 //NOTIMPLEMENTED(); |
| 507 return false; | 506 return false; |
| 508 } | 507 } |
| 509 | 508 |
| 510 void NativeWidgetAura::RunShellDrag(View* view, | 509 void NativeWidgetAura::RunShellDrag(View* view, |
| 511 const ui::OSExchangeData& data, | 510 const ui::OSExchangeData& data, |
| 512 int operation) { | 511 int operation) { |
| 513 aura::DragDropClient* client = static_cast<aura::DragDropClient*>( | 512 if (aura::client::GetDragDropClient()) |
| 514 aura::RootWindow::GetInstance()->GetProperty( | 513 aura::client::GetDragDropClient()->StartDragAndDrop(data, operation); |
| 515 aura::kRootWindowDragDropClientKey)); | |
| 516 if (client) | |
| 517 client->StartDragAndDrop(data, operation); | |
| 518 } | 514 } |
| 519 | 515 |
| 520 void NativeWidgetAura::SchedulePaintInRect(const gfx::Rect& rect) { | 516 void NativeWidgetAura::SchedulePaintInRect(const gfx::Rect& rect) { |
| 521 if (window_) | 517 if (window_) |
| 522 window_->SchedulePaintInRect(rect); | 518 window_->SchedulePaintInRect(rect); |
| 523 } | 519 } |
| 524 | 520 |
| 525 void NativeWidgetAura::SetCursor(gfx::NativeCursor cursor) { | 521 void NativeWidgetAura::SetCursor(gfx::NativeCursor cursor) { |
| 526 cursor_ = cursor; | 522 cursor_ = cursor; |
| 527 aura::RootWindow::GetInstance()->SetCursor(cursor); | 523 aura::RootWindow::GetInstance()->SetCursor(cursor); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 | 670 |
| 675 void NativeWidgetAura::OnCaptureLost() { | 671 void NativeWidgetAura::OnCaptureLost() { |
| 676 delegate_->OnMouseCaptureLost(); | 672 delegate_->OnMouseCaptureLost(); |
| 677 } | 673 } |
| 678 | 674 |
| 679 void NativeWidgetAura::OnPaint(gfx::Canvas* canvas) { | 675 void NativeWidgetAura::OnPaint(gfx::Canvas* canvas) { |
| 680 delegate_->OnNativeWidgetPaint(canvas); | 676 delegate_->OnNativeWidgetPaint(canvas); |
| 681 } | 677 } |
| 682 | 678 |
| 683 void NativeWidgetAura::OnWindowDestroying() { | 679 void NativeWidgetAura::OnWindowDestroying() { |
| 684 window_->SetProperty(aura::kDragDropDelegateKey, NULL); | |
| 685 delegate_->OnNativeWidgetDestroying(); | 680 delegate_->OnNativeWidgetDestroying(); |
| 686 | 681 |
| 687 // If the aura::Window is destroyed, we can no longer show tooltips. | 682 // If the aura::Window is destroyed, we can no longer show tooltips. |
| 688 tooltip_manager_.reset(); | 683 tooltip_manager_.reset(); |
| 689 } | 684 } |
| 690 | 685 |
| 691 void NativeWidgetAura::OnWindowDestroyed() { | 686 void NativeWidgetAura::OnWindowDestroyed() { |
| 692 window_ = NULL; | 687 window_ = NULL; |
| 693 tooltip_manager_.reset(); | 688 tooltip_manager_.reset(); |
| 694 delegate_->OnNativeWidgetDestroyed(); | 689 delegate_->OnNativeWidgetDestroyed(); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 } | 848 } |
| 854 } | 849 } |
| 855 | 850 |
| 856 // static | 851 // static |
| 857 bool NativeWidgetPrivate::IsMouseButtonDown() { | 852 bool NativeWidgetPrivate::IsMouseButtonDown() { |
| 858 return aura::RootWindow::GetInstance()->IsMouseButtonDown(); | 853 return aura::RootWindow::GetInstance()->IsMouseButtonDown(); |
| 859 } | 854 } |
| 860 | 855 |
| 861 } // namespace internal | 856 } // namespace internal |
| 862 } // namespace views | 857 } // namespace views |
| OLD | NEW |