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

Side by Side Diff: ui/app_list/app_list_bubble_border.cc

Issue 10544009: ash/app_list: Make applist bubble edge touch launcher bar edge. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « ash/shell.cc ('k') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/app_list/app_list_bubble_border.h" 5 #include "ui/app_list/app_list_bubble_border.h"
6 6
7 #include "third_party/skia/include/core/SkPath.h" 7 #include "third_party/skia/include/core/SkPath.h"
8 #include "third_party/skia/include/core/SkPaint.h" 8 #include "third_party/skia/include/core/SkPaint.h"
9 #include "third_party/skia/include/effects/SkGradientShader.h" 9 #include "third_party/skia/include/effects/SkGradientShader.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 int arrow_tip_x = insets.left() + contents_size.width() / 2 + 288 int arrow_tip_x = insets.left() + contents_size.width() / 2 +
289 GetArrowOffset(); 289 GetArrowOffset();
290 int arrow_tip_y = insets.top() + contents_size.height() / 2 + 290 int arrow_tip_y = insets.top() + contents_size.height() / 2 +
291 GetArrowOffset() + 1; 291 GetArrowOffset() + 1;
292 292
293 if (arrow_location() == views::BubbleBorder::TOP_LEFT || 293 if (arrow_location() == views::BubbleBorder::TOP_LEFT ||
294 arrow_location() == views::BubbleBorder::TOP_RIGHT) { 294 arrow_location() == views::BubbleBorder::TOP_RIGHT) {
295 // Arrow at top. 295 // Arrow at top.
296 return gfx::Rect( 296 return gfx::Rect(
297 gfx::Point(anchor_center_x - arrow_tip_x, 297 gfx::Point(anchor_center_x - arrow_tip_x,
298 position_relative_to.bottom() - shadow_padding.top()), 298 position_relative_to.bottom() - shadow_padding.top() -
299 kArrowHeight),
299 border_size); 300 border_size);
300 } else if (arrow_location() == views::BubbleBorder::BOTTOM_LEFT || 301 } else if (arrow_location() == views::BubbleBorder::BOTTOM_LEFT ||
301 arrow_location() == views::BubbleBorder::BOTTOM_RIGHT) { 302 arrow_location() == views::BubbleBorder::BOTTOM_RIGHT) {
302 // Arrow at bottom. 303 // Arrow at bottom.
303 return gfx::Rect( 304 return gfx::Rect(
304 gfx::Point(anchor_center_x - arrow_tip_x, 305 gfx::Point(anchor_center_x - arrow_tip_x,
305 position_relative_to.y() - border_size.height() + 306 position_relative_to.y() - border_size.height() +
306 shadow_padding.bottom()), 307 shadow_padding.bottom() + kArrowHeight),
307 border_size); 308 border_size);
308 } else if (arrow_location() == views::BubbleBorder::LEFT_TOP || 309 } else if (arrow_location() == views::BubbleBorder::LEFT_TOP ||
309 arrow_location() == views::BubbleBorder::LEFT_BOTTOM) { 310 arrow_location() == views::BubbleBorder::LEFT_BOTTOM) {
310 // Arrow on left. 311 // Arrow on left.
311 return gfx::Rect( 312 return gfx::Rect(
312 gfx::Point(position_relative_to.right() - shadow_padding.left(), 313 gfx::Point(position_relative_to.right() - shadow_padding.left() -
314 kArrowHeight,
313 anchor_center_y - arrow_tip_y), 315 anchor_center_y - arrow_tip_y),
314 border_size); 316 border_size);
315 } else if (arrow_location() == views::BubbleBorder::RIGHT_TOP || 317 } else if (arrow_location() == views::BubbleBorder::RIGHT_TOP ||
316 arrow_location() == views::BubbleBorder::RIGHT_BOTTOM) { 318 arrow_location() == views::BubbleBorder::RIGHT_BOTTOM) {
317 // Arrow on right. 319 // Arrow on right.
318 return gfx::Rect( 320 return gfx::Rect(
319 gfx::Point(position_relative_to.x() - border_size.width() + 321 gfx::Point(position_relative_to.x() - border_size.width() +
320 shadow_padding.right(), 322 shadow_padding.right() + kArrowHeight,
321 anchor_center_y - arrow_tip_y), 323 anchor_center_y - arrow_tip_y),
322 border_size); 324 border_size);
323 } 325 }
324 326
325 // No arrow bubble, center align with anchor. 327 // No arrow bubble, center align with anchor.
326 return position_relative_to.Center(border_size); 328 return position_relative_to.Center(border_size);
327 } 329 }
328 330
329 void AppListBubbleBorder::Paint(const views::View& view, 331 void AppListBubbleBorder::Paint(const views::View& view,
330 gfx::Canvas* canvas) const { 332 gfx::Canvas* canvas) const {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 // Use full bounds so that arrow is also painted. 365 // Use full bounds so that arrow is also painted.
364 const gfx::Rect& bounds = view.bounds(); 366 const gfx::Rect& bounds = view.bounds();
365 PaintSearchBoxBackground(canvas, bounds); 367 PaintSearchBoxBackground(canvas, bounds);
366 PaintAppsGridBackground(canvas, bounds); 368 PaintAppsGridBackground(canvas, bounds);
367 PaintSearchResultListBackground(canvas, bounds); 369 PaintSearchResultListBackground(canvas, bounds);
368 370
369 canvas->Restore(); 371 canvas->Restore();
370 } 372 }
371 373
372 } // namespace app_list 374 } // namespace app_list
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698