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

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

Issue 2769014: Mac/clang: Possibly contentious changes. (Closed)
Patch Set: comments2 Created 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_edit_view_mac.h" 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_mac.h"
6 6
7 #include <Carbon/Carbon.h> // kVK_Return 7 #include <Carbon/Carbon.h> // kVK_Return
8 8
9 #include "app/clipboard/clipboard.h" 9 #include "app/clipboard/clipboard.h"
10 #include "app/clipboard/scoped_clipboard_writer.h" 10 #include "app/clipboard/scoped_clipboard_writer.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // scope, when the window resigns key the autocomplete popup is 48 // scope, when the window resigns key the autocomplete popup is
49 // closed. |model_| still believes it has focus, and the popup will 49 // closed. |model_| still believes it has focus, and the popup will
50 // be regenerated on the user's next edit. That seems to match how 50 // be regenerated on the user's next edit. That seems to match how
51 // things work on other platforms. 51 // things work on other platforms.
52 52
53 namespace { 53 namespace {
54 54
55 // TODO(shess): This is ugly, find a better way. Using it right now 55 // TODO(shess): This is ugly, find a better way. Using it right now
56 // so that I can crib from gtk and still be able to see that I'm using 56 // so that I can crib from gtk and still be able to see that I'm using
57 // the same values easily. 57 // the same values easily.
58 const NSColor* ColorWithRGBBytes(int rr, int gg, int bb) { 58 NSColor* ColorWithRGBBytes(int rr, int gg, int bb) {
59 DCHECK_LE(rr, 255); 59 DCHECK_LE(rr, 255);
60 DCHECK_LE(bb, 255); 60 DCHECK_LE(bb, 255);
61 DCHECK_LE(gg, 255); 61 DCHECK_LE(gg, 255);
62 return [NSColor colorWithCalibratedRed:static_cast<float>(rr)/255.0 62 return [NSColor colorWithCalibratedRed:static_cast<float>(rr)/255.0
63 green:static_cast<float>(gg)/255.0 63 green:static_cast<float>(gg)/255.0
64 blue:static_cast<float>(bb)/255.0 64 blue:static_cast<float>(bb)/255.0
65 alpha:1.0]; 65 alpha:1.0];
66 } 66 }
67 67
68 const NSColor* HostTextColor() { 68 NSColor* HostTextColor() {
69 return [NSColor blackColor]; 69 return [NSColor blackColor];
70 } 70 }
71 const NSColor* BaseTextColor() { 71 NSColor* BaseTextColor() {
72 return [NSColor darkGrayColor]; 72 return [NSColor darkGrayColor];
73 } 73 }
74 const NSColor* EVSecureSchemeColor() { 74 NSColor* EVSecureSchemeColor() {
75 return ColorWithRGBBytes(0x07, 0x95, 0x00); 75 return ColorWithRGBBytes(0x07, 0x95, 0x00);
76 } 76 }
77 const NSColor* SecureSchemeColor() { 77 NSColor* SecureSchemeColor() {
78 return ColorWithRGBBytes(0x00, 0x0e, 0x95); 78 return ColorWithRGBBytes(0x00, 0x0e, 0x95);
79 } 79 }
80 const NSColor* SecurityErrorSchemeColor() { 80 NSColor* SecurityErrorSchemeColor() {
81 return ColorWithRGBBytes(0xa2, 0x00, 0x00); 81 return ColorWithRGBBytes(0xa2, 0x00, 0x00);
82 } 82 }
83 83
84 // Store's the model and view state across tab switches. 84 // Store's the model and view state across tab switches.
85 struct AutocompleteEditViewMacState { 85 struct AutocompleteEditViewMacState {
86 AutocompleteEditViewMacState(const AutocompleteEditModel::State model_state, 86 AutocompleteEditViewMacState(const AutocompleteEditModel::State model_state,
87 const bool has_focus, const NSRange& selection) 87 const bool has_focus, const NSRange& selection)
88 : model_state(model_state), 88 : model_state(model_state),
89 has_focus(has_focus), 89 has_focus(has_focus),
90 selection(selection) { 90 selection(selection) {
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 } 922 }
923 923
924 return std::wstring(); 924 return std::wstring();
925 } 925 }
926 926
927 // static 927 // static
928 NSFont* AutocompleteEditViewMac::GetFieldFont() { 928 NSFont* AutocompleteEditViewMac::GetFieldFont() {
929 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 929 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
930 return rb.GetFont(ResourceBundle::BaseFont).nativeFont(); 930 return rb.GetFont(ResourceBundle::BaseFont).nativeFont();
931 } 931 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698