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

Side by Side Diff: chrome/browser/cocoa/location_bar/ev_bubble_decoration.mm

Issue 2805070: [Mac] First part of Omnibox decoration refactor. Enable ev bubble. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: comment clarification Created 10 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #import "chrome/browser/cocoa/location_bar/ev_bubble_decoration.h"
6
7 #import "base/logging.h"
8 #import "chrome/browser/cocoa/image_utils.h"
9 #import "chrome/browser/cocoa/location_bar/location_icon_decoration.h"
10
11 namespace {
12
13 // TODO(shess): This is ugly, find a better way. Using it right now
14 // so that I can crib from gtk and still be able to see that I'm using
15 // the same values easily.
16 const NSColor* ColorWithRGBBytes(int rr, int gg, int bb) {
17 DCHECK_LE(rr, 255);
18 DCHECK_LE(bb, 255);
19 DCHECK_LE(gg, 255);
20 return [NSColor colorWithCalibratedRed:static_cast<float>(rr)/255.0
21 green:static_cast<float>(gg)/255.0
22 blue:static_cast<float>(bb)/255.0
23 alpha:1.0];
24 }
25
26 } // namespace
27
28 EVBubbleDecoration::EVBubbleDecoration(
29 LocationIconDecoration* location_icon,
30 NSFont* font)
31 : BubbleDecoration(font),
32 location_icon_(location_icon) {
33 // Color tuples stolen from location_bar_view_gtk.cc.
34 NSColor* border_color = ColorWithRGBBytes(0x90, 0xc3, 0x90);
35 NSColor* background_color = ColorWithRGBBytes(0xef, 0xfc, 0xef);
36 NSColor* text_color = ColorWithRGBBytes(0x07, 0x95, 0x00);
37 SetColors(border_color, background_color, text_color);
38 }
39
40 // Pass mouse operations through to location icon.
41 bool EVBubbleDecoration::IsDraggable() {
42 return location_icon_->IsDraggable();
43 }
44
45 NSPasteboard* EVBubbleDecoration::GetDragPasteboard() {
46 return location_icon_->GetDragPasteboard();
47 }
48
49 NSImage* EVBubbleDecoration::GetDragImage() {
50 return location_icon_->GetDragImage();
51 }
52
53 bool EVBubbleDecoration::OnMousePressed(NSRect frame) {
54 return location_icon_->OnMousePressed(frame);
55 }
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/location_bar/ev_bubble_decoration.h ('k') | chrome/browser/cocoa/location_bar/location_bar_decoration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698