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

Side by Side Diff: ui/aura_shell/tooltip_controller.cc

Issue 8968022: Shell related switches -> aura shell switches. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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 | « ui/aura_shell/stacking_controller.cc ('k') | ui/aura_shell/toplevel_layout_manager.cc » ('j') | 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) 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/aura_shell/tooltip_controller.h" 5 #include "ui/aura_shell/tooltip_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/string_split.h" 11 #include "base/string_split.h"
12 #include "base/time.h" 12 #include "base/time.h"
13 #include "ui/aura/aura_switches.h" 13 #include "ui/aura_shell/aura_shell_switches.h"
14 #include "ui/aura/client/aura_constants.h"
15 #include "ui/aura/event.h" 14 #include "ui/aura/event.h"
16 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
17 #include "ui/aura_shell/shell.h" 16 #include "ui/aura_shell/shell.h"
18 #include "ui/base/resource/resource_bundle.h" 17 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/base/text/text_elider.h" 18 #include "ui/base/text/text_elider.h"
20 #include "ui/gfx/font.h" 19 #include "ui/gfx/font.h"
21 #include "ui/gfx/point.h" 20 #include "ui/gfx/point.h"
22 #include "ui/gfx/rect.h" 21 #include "ui/gfx/rect.h"
23 #include "ui/gfx/screen.h" 22 #include "ui/gfx/screen.h"
24 #include "ui/views/background.h" 23 #include "ui/views/background.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // Updates the text on the tooltip and resizes to fit. 148 // Updates the text on the tooltip and resizes to fit.
150 void SetText(string16 tooltip_text, gfx::Point location) { 149 void SetText(string16 tooltip_text, gfx::Point location) {
151 int max_width, line_count; 150 int max_width, line_count;
152 TrimTooltipToFit(&tooltip_text, &max_width, &line_count, 151 TrimTooltipToFit(&tooltip_text, &max_width, &line_count,
153 location.x(), location.y()); 152 location.x(), location.y());
154 label_.SetText(tooltip_text); 153 label_.SetText(tooltip_text);
155 154
156 int width = max_width + 2 * kTooltipHorizontalPadding; 155 int width = max_width + 2 * kTooltipHorizontalPadding;
157 int height = label_.GetPreferredSize().height() + 156 int height = label_.GetPreferredSize().height() +
158 2 * kTooltipVerticalPadding; 157 2 * kTooltipVerticalPadding;
159 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraNoShadows)) { 158 if (CommandLine::ForCurrentProcess()->HasSwitch(
159 switches::kAuraNoShadows)) {
160 width += 2 * kTooltipBorderWidth; 160 width += 2 * kTooltipBorderWidth;
161 height += 2 * kTooltipBorderWidth; 161 height += 2 * kTooltipBorderWidth;
162 } 162 }
163 SetTooltipBounds(location, width, height); 163 SetTooltipBounds(location, width, height);
164 } 164 }
165 165
166 // Shows the tooltip. 166 // Shows the tooltip.
167 void Show() { 167 void Show() {
168 widget_->Show(); 168 widget_->Show();
169 } 169 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 gfx::Point widget_loc = curr_mouse_loc_; 287 gfx::Point widget_loc = curr_mouse_loc_;
288 widget_loc = widget_loc.Add(tooltip_window_->GetScreenBounds().origin()); 288 widget_loc = widget_loc.Add(tooltip_window_->GetScreenBounds().origin());
289 tooltip_->SetText(tooltip_text, widget_loc); 289 tooltip_->SetText(tooltip_text, widget_loc);
290 tooltip_->Show(); 290 tooltip_->Show();
291 } 291 }
292 } 292 }
293 } 293 }
294 294
295 } // namespace internal 295 } // namespace internal
296 } // namespace aura_shell 296 } // namespace aura_shell
OLDNEW
« no previous file with comments | « ui/aura_shell/stacking_controller.cc ('k') | ui/aura_shell/toplevel_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698