OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "mash/shelf/shelf_tooltip_manager.h" | 5 #include "mash/shelf/shelf_tooltip_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
11 #include "components/mus/public/cpp/property_type_converters.h" | 11 #include "components/mus/public/cpp/property_type_converters.h" |
12 #include "mash/shelf/shelf_view.h" | 12 #include "mash/shelf/shelf_view.h" |
13 #include "mash/wm/public/interfaces/container.mojom.h" | 13 #include "mash/wm/public/interfaces/container.mojom.h" |
14 #include "mojo/shell/public/cpp/application_impl.h" | |
15 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
16 #include "ui/events/event.h" | 15 #include "ui/events/event.h" |
17 #include "ui/events/event_constants.h" | 16 #include "ui/events/event_constants.h" |
18 #include "ui/gfx/geometry/insets.h" | 17 #include "ui/gfx/geometry/insets.h" |
19 #include "ui/views/bubble/bubble_delegate.h" | 18 #include "ui/views/bubble/bubble_delegate.h" |
20 #include "ui/views/controls/label.h" | 19 #include "ui/views/controls/label.h" |
21 #include "ui/views/layout/fill_layout.h" | 20 #include "ui/views/layout/fill_layout.h" |
22 #include "ui/views/mus/native_widget_mus.h" | 21 #include "ui/views/mus/native_widget_mus.h" |
23 #include "ui/views/mus/window_manager_connection.h" | 22 #include "ui/views/mus/window_manager_connection.h" |
24 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 views::Widget::InitParams* params, | 116 views::Widget::InitParams* params, |
118 views::Widget* widget) const { | 117 views::Widget* widget) const { |
119 // Ensure the widget is treated as a tooltip by the window manager. | 118 // Ensure the widget is treated as a tooltip by the window manager. |
120 std::map<std::string, std::vector<uint8_t>> properties; | 119 std::map<std::string, std::vector<uint8_t>> properties; |
121 properties[mash::wm::mojom::kWindowContainer_Property] = | 120 properties[mash::wm::mojom::kWindowContainer_Property] = |
122 mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( | 121 mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( |
123 static_cast<int32_t>(mash::wm::mojom::Container::TOOLTIPS)); | 122 static_cast<int32_t>(mash::wm::mojom::Container::TOOLTIPS)); |
124 mus::Window* window = | 123 mus::Window* window = |
125 views::WindowManagerConnection::Get()->NewWindow(properties); | 124 views::WindowManagerConnection::Get()->NewWindow(properties); |
126 params->native_widget = new views::NativeWidgetMus( | 125 params->native_widget = new views::NativeWidgetMus( |
127 widget, host_->shelf_view()->app()->shell(), window, | 126 widget, host_->shelf_view()->shell(), window, |
128 mus::mojom::SurfaceType::DEFAULT); | 127 mus::mojom::SurfaceType::DEFAULT); |
129 } | 128 } |
130 | 129 |
131 void ShelfTooltipManager::ShelfTooltipBubble::WindowClosing() { | 130 void ShelfTooltipManager::ShelfTooltipBubble::WindowClosing() { |
132 views::BubbleDelegateView::WindowClosing(); | 131 views::BubbleDelegateView::WindowClosing(); |
133 if (host_) | 132 if (host_) |
134 host_->OnBubbleClosed(this); | 133 host_->OnBubbleClosed(this); |
135 } | 134 } |
136 | 135 |
137 bool ShelfTooltipManager::ShelfTooltipBubble::ShouldShowWindowTitle() const { | 136 bool ShelfTooltipManager::ShelfTooltipBubble::ShouldShowWindowTitle() const { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 base::OneShotTimer* new_timer = new base::OneShotTimer(); | 351 base::OneShotTimer* new_timer = new base::OneShotTimer(); |
353 new_timer->Start(FROM_HERE, | 352 new_timer->Start(FROM_HERE, |
354 base::TimeDelta::FromMilliseconds(delay_in_ms), | 353 base::TimeDelta::FromMilliseconds(delay_in_ms), |
355 this, | 354 this, |
356 &ShelfTooltipManager::ShowInternal); | 355 &ShelfTooltipManager::ShowInternal); |
357 timer_.reset(new_timer); | 356 timer_.reset(new_timer); |
358 } | 357 } |
359 | 358 |
360 } // namespace shelf | 359 } // namespace shelf |
361 } // namespace mash | 360 } // namespace mash |
OLD | NEW |