OLD | NEW |
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 "chrome/browser/ui/intents/web_intent_picker.h" | 5 #include "chrome/browser/ui/intents/web_intent_picker.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 #include "content/public/browser/web_contents_view.h" | 10 #include "content/public/browser/web_contents_view.h" |
11 #include "grit/theme_resources.h" | 11 #include "grit/theme_resources.h" |
12 #include "ui/gfx/size.h" | 12 #include "ui/gfx/size.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // Maximum inline disposition container sizes. | 16 // Maximum inline disposition container sizes. |
17 const int kMaxInlineDispositionWidth = 900; | 17 const int kMaxInlineDispositionWidth = 900; |
18 const int kMaxInlineDispositionHeight = 900; | 18 const int kMaxInlineDispositionHeight = 900; |
19 | 19 |
20 } // namespace | 20 } // namespace |
21 | 21 |
22 // static | 22 // static |
23 gfx::Size WebIntentPicker::GetMinInlineDispositionSize() { | 23 gfx::Size WebIntentPicker::GetMinInlineDispositionSize() { |
24 return gfx::Size(0, 0); | 24 return gfx::Size(1, 1); |
25 } | 25 } |
26 | 26 |
27 // static | 27 // static |
28 gfx::Size WebIntentPicker::GetMaxInlineDispositionSize() { | 28 gfx::Size WebIntentPicker::GetMaxInlineDispositionSize() { |
29 return gfx::Size(kMaxInlineDispositionWidth, kMaxInlineDispositionHeight); | 29 return gfx::Size(kMaxInlineDispositionWidth, kMaxInlineDispositionHeight); |
30 } | 30 } |
31 | 31 |
32 // static | 32 // static |
33 int WebIntentPicker::GetNthStarImageIdFromCWSRating(double rating, int index) { | 33 int WebIntentPicker::GetNthStarImageIdFromCWSRating(double rating, int index) { |
34 // The fractional part of the rating is converted to stars as: | 34 // The fractional part of the rating is converted to stars as: |
(...skipping 11 matching lines...) Expand all Loading... |
46 | 46 |
47 // We don't need to test against the upper bound (kHalfStarMax); when the | 47 // We don't need to test against the upper bound (kHalfStarMax); when the |
48 // fractional part is greater than kHalfStarMax, full_stars will be rounded | 48 // fractional part is greater than kHalfStarMax, full_stars will be rounded |
49 // up, which means rating - full_stars is negative. | 49 // up, which means rating - full_stars is negative. |
50 bool half_star = rating - full_stars >= kHalfStarMin; | 50 bool half_star = rating - full_stars >= kHalfStarMin; |
51 | 51 |
52 return index == full_stars && half_star ? | 52 return index == full_stars && half_star ? |
53 IDR_CWS_STAR_HALF : | 53 IDR_CWS_STAR_HALF : |
54 IDR_CWS_STAR_EMPTY; | 54 IDR_CWS_STAR_EMPTY; |
55 } | 55 } |
OLD | NEW |