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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_popup_view_mac.mm

Issue 188014: [Mac] Make Omnibox a little bit transparent. (Closed)
Patch Set: Tweak for pkasting Created 11 years, 3 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
« 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/autocomplete/autocomplete_popup_view_mac.h" 5 #include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h"
6 6
7 #include "app/gfx/text_elider.h" 7 #include "app/gfx/text_elider.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "base/gfx/rect.h" 9 #include "base/gfx/rect.h"
10 #include "chrome/browser/autocomplete/autocomplete_edit.h" 10 #include "chrome/browser/autocomplete/autocomplete_edit.h"
(...skipping 12 matching lines...) Expand all
23 // by the font. 23 // by the font.
24 const int kCellHeightAdjust = 7.0; 24 const int kCellHeightAdjust = 7.0;
25 25
26 // How to round off the popup's corners. Goal is to match star and go 26 // How to round off the popup's corners. Goal is to match star and go
27 // buttons. 27 // buttons.
28 const CGFloat kPopupRoundingRadius = 3.5; 28 const CGFloat kPopupRoundingRadius = 3.5;
29 29
30 // Gap between the field and the popup. 30 // Gap between the field and the popup.
31 const CGFloat kPopupFieldGap = 2.0; 31 const CGFloat kPopupFieldGap = 2.0;
32 32
33 // How opaque the popup window should be. This matches Windows (see
34 // autocomplete_popup_contents_view.cc, kGlassPopupTransparency).
35 const CGFloat kPopupAlpha = 240.0 / 255.0;
36
33 // How much space to leave for the left and right margins. 37 // How much space to leave for the left and right margins.
34 const CGFloat kLeftRightMargin = 8.0; 38 const CGFloat kLeftRightMargin = 8.0;
35 39
36 // How far to offset the text column from the left. 40 // How far to offset the text column from the left.
37 const CGFloat kTextXOffset = 33.0; 41 const CGFloat kTextXOffset = 33.0;
38 42
39 // Animation duration when animating the popup window smaller. 43 // Animation duration when animating the popup window smaller.
40 const float kShrinkAnimationDuration = 0.1; 44 const float kShrinkAnimationDuration = 0.1;
41 45
42 // Maximum fraction of the popup width that can be used to display match 46 // Maximum fraction of the popup width that can be used to display match
43 // contents. 47 // contents.
44 const float kMaxMatchContentsWidth = 0.7; 48 const float kMaxMatchContentsWidth = 0.7;
45 49
46 // NSEvent -buttonNumber for middle mouse button. 50 // NSEvent -buttonNumber for middle mouse button.
47 const static NSInteger kMiddleButtonNumber(2); 51 const static NSInteger kMiddleButtonNumber(2);
48 52
49 // Background colors for different states of the popup elements. 53 // Background colors for different states of the popup elements.
50 NSColor* BackgroundColor() { 54 NSColor* BackgroundColor() {
51 return [NSColor controlBackgroundColor]; 55 return [[NSColor controlBackgroundColor] colorWithAlphaComponent:kPopupAlpha];
52 } 56 }
53 NSColor* SelectedBackgroundColor() { 57 NSColor* SelectedBackgroundColor() {
54 return [NSColor selectedControlColor]; 58 return [[NSColor selectedControlColor] colorWithAlphaComponent:kPopupAlpha];
55 } 59 }
56 NSColor* HoveredBackgroundColor() { 60 NSColor* HoveredBackgroundColor() {
57 return [NSColor controlColor]; 61 return [[NSColor controlHighlightColor] colorWithAlphaComponent:kPopupAlpha];
58 } 62 }
59 63
60 // TODO(shess): These are totally unprincipled. I experimented with 64 // TODO(shess): These are totally unprincipled. I experimented with
61 // +controlTextColor and the like, but found myself wondering whether 65 // +controlTextColor and the like, but found myself wondering whether
62 // that was really appropriate. Circle back after consulting with 66 // that was really appropriate. Circle back after consulting with
63 // someone more knowledgeable about the ins and outs of this. 67 // someone more knowledgeable about the ins and outs of this.
64 static const NSColor* ContentTextColor() { 68 static const NSColor* ContentTextColor() {
65 return [NSColor blackColor]; 69 return [NSColor blackColor];
66 } 70 }
67 static const NSColor* URLTextColor() { 71 static const NSColor* URLTextColor() {
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 DCHECK(popup_view_); 696 DCHECK(popup_view_);
693 697
694 // TODO(shess): UpdatePopupAppearance() is called frequently, so it 698 // TODO(shess): UpdatePopupAppearance() is called frequently, so it
695 // should be really cheap, but in this case we could probably make 699 // should be really cheap, but in this case we could probably make
696 // things even cheaper by refactoring between the popup-placement 700 // things even cheaper by refactoring between the popup-placement
697 // code and the matrix-population code. 701 // code and the matrix-population code.
698 popup_view_->UpdatePopupAppearance(); 702 popup_view_->UpdatePopupAppearance();
699 } 703 }
700 704
701 @end 705 @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