| 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 "chrome/browser/ui/views/autofill/tooltip_icon.h" | 5 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/timer/timer.h" | 8 #include "base/timer/timer.h" |
| 9 #include "chrome/browser/ui/views/autofill/info_bubble.h" | 9 #include "chrome/browser/ui/views/autofill/info_bubble.h" |
| 10 #include "ui/accessibility/ax_view_state.h" | 10 #include "ui/accessibility/ax_view_state.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 bubble_->set_arrow(bubble_arrow_); | 118 bubble_->set_arrow(bubble_arrow_); |
| 119 // When shown due to a gesture event, close on deactivate (i.e. don't use | 119 // When shown due to a gesture event, close on deactivate (i.e. don't use |
| 120 // "focusless"). | 120 // "focusless"). |
| 121 bubble_->set_can_activate(!mouse_inside_); | 121 bubble_->set_can_activate(!mouse_inside_); |
| 122 | 122 |
| 123 bubble_->Show(); | 123 bubble_->Show(); |
| 124 observer_.Add(bubble_->GetWidget()); | 124 observer_.Add(bubble_->GetWidget()); |
| 125 | 125 |
| 126 if (mouse_inside_) { | 126 if (mouse_inside_) { |
| 127 views::View* frame = bubble_->GetWidget()->non_client_view()->frame_view(); | 127 views::View* frame = bubble_->GetWidget()->non_client_view()->frame_view(); |
| 128 scoped_ptr<views::MouseWatcherHost> host( | 128 std::unique_ptr<views::MouseWatcherHost> host( |
| 129 new views::MouseWatcherViewHost(frame, gfx::Insets())); | 129 new views::MouseWatcherViewHost(frame, gfx::Insets())); |
| 130 mouse_watcher_.reset(new views::MouseWatcher(host.release(), this)); | 130 mouse_watcher_.reset(new views::MouseWatcher(host.release(), this)); |
| 131 mouse_watcher_->Start(); | 131 mouse_watcher_->Start(); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 void TooltipIcon::HideBubble() { | 135 void TooltipIcon::HideBubble() { |
| 136 if (bubble_) | 136 if (bubble_) |
| 137 bubble_->Hide(); | 137 bubble_->Hide(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void TooltipIcon::OnWidgetDestroyed(views::Widget* widget) { | 140 void TooltipIcon::OnWidgetDestroyed(views::Widget* widget) { |
| 141 observer_.Remove(widget); | 141 observer_.Remove(widget); |
| 142 | 142 |
| 143 SetDrawAsHovered(false); | 143 SetDrawAsHovered(false); |
| 144 mouse_watcher_.reset(); | 144 mouse_watcher_.reset(); |
| 145 bubble_ = NULL; | 145 bubble_ = NULL; |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace autofill | 148 } // namespace autofill |
| OLD | NEW |