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

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_mac.mm

Issue 140067: Only show tooltip when window is key.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/renderer_host/render_widget_host_view_mac.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #include "base/histogram.h" 7 #include "base/histogram.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "chrome/browser/browser_trial.h" 9 #include "chrome/browser/browser_trial.h"
10 #include "chrome/browser/renderer_host/backing_store.h" 10 #include "chrome/browser/renderer_host/backing_store.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // contained within this view (and are unknown to the NSView system), we 260 // contained within this view (and are unknown to the NSView system), we
261 // are forced to implement our own tooltips with child windows. 261 // are forced to implement our own tooltips with child windows.
262 // TODO(pinkerton): Do we want these tooltips to time out after a certain time? 262 // TODO(pinkerton): Do we want these tooltips to time out after a certain time?
263 // Gecko does this automatically in the back-end, hence the ToolTip class not 263 // Gecko does this automatically in the back-end, hence the ToolTip class not
264 // needing that functionality. We can either modify ToolTip or add this 264 // needing that functionality. We can either modify ToolTip or add this
265 // functionality here with a timer. 265 // functionality here with a timer.
266 // TODO(pinkerton): This code really needs to live at a higher level because 266 // TODO(pinkerton): This code really needs to live at a higher level because
267 // right now it allows multiple views in multiple tabs to each be displaying 267 // right now it allows multiple views in multiple tabs to each be displaying
268 // a tooltip simultaneously (http://crbug.com/14178). 268 // a tooltip simultaneously (http://crbug.com/14178).
269 void RenderWidgetHostViewMac::SetTooltipText(const std::wstring& tooltip_text) { 269 void RenderWidgetHostViewMac::SetTooltipText(const std::wstring& tooltip_text) {
270 if (tooltip_text != tooltip_text_ && [[cocoa_view_ window] isMainWindow]) { 270 if (tooltip_text != tooltip_text_ && [[cocoa_view_ window] isKeyWindow]) {
271 tooltip_text_ = tooltip_text; 271 tooltip_text_ = tooltip_text;
272 272
273 // Clamp the tooltip length to kMaxTooltipLength. It's a DOS issue on 273 // Clamp the tooltip length to kMaxTooltipLength. It's a DOS issue on
274 // Windows; we're just trying to be polite. Don't persist the trimmed 274 // Windows; we're just trying to be polite. Don't persist the trimmed
275 // string, as then the comparison above will always fail and we'll try to 275 // string, as then the comparison above will always fail and we'll try to
276 // set it again every single time the mouse moves. 276 // set it again every single time the mouse moves.
277 std::wstring display_text = tooltip_text_; 277 std::wstring display_text = tooltip_text_;
278 if (tooltip_text_.length() > kMaxTooltipLength) 278 if (tooltip_text_.length() > kMaxTooltipLength)
279 display_text = tooltip_text_.substr(0, kMaxTooltipLength); 279 display_text = tooltip_text_.substr(0, kMaxTooltipLength);
280 280
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 503
504 if (closeOnDeactivate_) 504 if (closeOnDeactivate_)
505 renderWidgetHostView_->KillSelf(); 505 renderWidgetHostView_->KillSelf();
506 506
507 renderWidgetHostView_->render_widget_host_->Blur(); 507 renderWidgetHostView_->render_widget_host_->Blur();
508 508
509 return YES; 509 return YES;
510 } 510 }
511 511
512 @end 512 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698