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

Side by Side Diff: chrome/browser/download/download_util.cc

Issue 6334152: Clean up RTL methods.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 (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 // Download utility implementation 5 // Download utility implementation
6 6
7 #include "chrome/browser/download/download_util.h" 7 #include "chrome/browser/download/download_util.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <shobjidl.h> 10 #include <shobjidl.h>
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 370
371 // We start by storing the bounds of the background and foreground bitmaps 371 // We start by storing the bounds of the background and foreground bitmaps
372 // so that it is easy to mirror the bounds if the UI layout is RTL. 372 // so that it is easy to mirror the bounds if the UI layout is RTL.
373 gfx::Rect background_bounds(origin_x, origin_y, 373 gfx::Rect background_bounds(origin_x, origin_y,
374 background->width(), background->height()); 374 background->width(), background->height());
375 gfx::Rect foreground_bounds(origin_x, origin_y, 375 gfx::Rect foreground_bounds(origin_x, origin_y,
376 foreground->width(), foreground->height()); 376 foreground->width(), foreground->height());
377 377
378 #if defined(TOOLKIT_VIEWS) 378 #if defined(TOOLKIT_VIEWS)
379 // Mirror the positions if necessary. 379 // Mirror the positions if necessary.
380 int mirrored_x = containing_view->MirroredLeftPointForRect(background_bounds); 380 int mirrored_x = containing_view->GetMirroredXForRect(background_bounds);
381 background_bounds.set_x(mirrored_x); 381 background_bounds.set_x(mirrored_x);
382 mirrored_x = containing_view->MirroredLeftPointForRect(foreground_bounds); 382 mirrored_x = containing_view->GetMirroredXForRect(foreground_bounds);
383 foreground_bounds.set_x(mirrored_x); 383 foreground_bounds.set_x(mirrored_x);
384 #endif 384 #endif
385 385
386 // Draw the background progress image. 386 // Draw the background progress image.
387 SkPaint background_paint; 387 SkPaint background_paint;
388 canvas->DrawBitmapInt(*background, 388 canvas->DrawBitmapInt(*background,
389 background_bounds.x(), 389 background_bounds.x(),
390 background_bounds.y(), 390 background_bounds.y(),
391 background_paint); 391 background_paint);
392 392
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 g_foreground_16 = rb.GetBitmapNamed(IDR_DOWNLOAD_PROGRESS_FOREGROUND_16); 457 g_foreground_16 = rb.GetBitmapNamed(IDR_DOWNLOAD_PROGRESS_FOREGROUND_16);
458 g_foreground_32 = rb.GetBitmapNamed(IDR_DOWNLOAD_PROGRESS_FOREGROUND_32); 458 g_foreground_32 = rb.GetBitmapNamed(IDR_DOWNLOAD_PROGRESS_FOREGROUND_32);
459 } 459 }
460 460
461 SkBitmap* complete = (size == BIG) ? g_foreground_32 : g_foreground_16; 461 SkBitmap* complete = (size == BIG) ? g_foreground_32 : g_foreground_16;
462 462
463 gfx::Rect complete_bounds(origin_x, origin_y, 463 gfx::Rect complete_bounds(origin_x, origin_y,
464 complete->width(), complete->height()); 464 complete->width(), complete->height());
465 #if defined(TOOLKIT_VIEWS) 465 #if defined(TOOLKIT_VIEWS)
466 // Mirror the positions if necessary. 466 // Mirror the positions if necessary.
467 complete_bounds.set_x( 467 complete_bounds.set_x(containing_view->GetMirroredXForRect(complete_bounds));
468 containing_view->MirroredLeftPointForRect(complete_bounds));
469 #endif 468 #endif
470 469
471 // Start at full opacity, then loop back and forth five times before ending 470 // Start at full opacity, then loop back and forth five times before ending
472 // at zero opacity. 471 // at zero opacity.
473 static const double PI = 3.141592653589793; 472 static const double PI = 3.141592653589793;
474 double opacity = sin(animation_progress * PI * kCompleteAnimationCycles + 473 double opacity = sin(animation_progress * PI * kCompleteAnimationCycles +
475 PI/2) / 2 + 0.5; 474 PI/2) / 2 + 0.5;
476 475
477 canvas->SaveLayerAlpha(static_cast<int>(255.0 * opacity), complete_bounds); 476 canvas->SaveLayerAlpha(static_cast<int>(255.0 * opacity), complete_bounds);
478 canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); 477 canvas->AsCanvasSkia()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 !service->IsDownloadFromGallery(info->url, info->referrer_url)) { 813 !service->IsDownloadFromGallery(info->url, info->referrer_url)) {
815 // Extensions that are not from the gallery are considered dangerous. 814 // Extensions that are not from the gallery are considered dangerous.
816 ret = true; 815 ret = true;
817 } 816 }
818 } 817 }
819 818
820 return ret; 819 return ret;
821 } 820 }
822 821
823 } // namespace download_util 822 } // namespace download_util
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/input_method/candidate_window.cc ('k') | chrome/browser/ui/touch/tabs/touch_tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698