Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: chrome/browser/ui/views/autofill/tooltip_icon.cc

Issue 413433002: Refactor BubbleDelegateView::use_focuseless() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cros compilation Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/basictypes.h" 7 #include "base/basictypes.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 "grit/theme_resources.h" 10 #include "grit/theme_resources.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 void TooltipIcon::ShowBubble() { 108 void TooltipIcon::ShowBubble() {
109 if (bubble_) 109 if (bubble_)
110 return; 110 return;
111 111
112 ChangeImageTo(IDR_AUTOFILL_TOOLTIP_ICON_H); 112 ChangeImageTo(IDR_AUTOFILL_TOOLTIP_ICON_H);
113 113
114 bubble_ = new TooltipBubble(this, tooltip_); 114 bubble_ = new TooltipBubble(this, tooltip_);
115 // When shown due to a gesture event, close on deactivate (i.e. don't use 115 // When shown due to a gesture event, close on deactivate (i.e. don't use
116 // "focusless"). 116 // "focusless").
117 bubble_->set_use_focusless(mouse_inside_); 117 bubble_->set_can_activate(!mouse_inside_);
118 118
119 bubble_->Show(); 119 bubble_->Show();
120 observer_.Add(bubble_->GetWidget()); 120 observer_.Add(bubble_->GetWidget());
121 121
122 if (mouse_inside_) { 122 if (mouse_inside_) {
123 views::View* frame = bubble_->GetWidget()->non_client_view()->frame_view(); 123 views::View* frame = bubble_->GetWidget()->non_client_view()->frame_view();
124 scoped_ptr<views::MouseWatcherHost> host( 124 scoped_ptr<views::MouseWatcherHost> host(
125 new views::MouseWatcherViewHost(frame, gfx::Insets())); 125 new views::MouseWatcherViewHost(frame, gfx::Insets()));
126 mouse_watcher_.reset(new views::MouseWatcher(host.release(), this)); 126 mouse_watcher_.reset(new views::MouseWatcher(host.release(), this));
127 mouse_watcher_->Start(); 127 mouse_watcher_->Start();
128 } 128 }
129 } 129 }
130 130
131 void TooltipIcon::HideBubble() { 131 void TooltipIcon::HideBubble() {
132 if (bubble_) 132 if (bubble_)
133 bubble_->Hide(); 133 bubble_->Hide();
134 } 134 }
135 135
136 void TooltipIcon::OnWidgetDestroyed(views::Widget* widget) { 136 void TooltipIcon::OnWidgetDestroyed(views::Widget* widget) {
137 observer_.Remove(widget); 137 observer_.Remove(widget);
138 138
139 ChangeImageTo(IDR_AUTOFILL_TOOLTIP_ICON); 139 ChangeImageTo(IDR_AUTOFILL_TOOLTIP_ICON);
140 mouse_watcher_.reset(); 140 mouse_watcher_.reset();
141 bubble_ = NULL; 141 bubble_ = NULL;
142 } 142 }
143 143
144 } // namespace autofill 144 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698