| OLD | NEW |
| 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 #import "chrome/browser/cocoa/location_bar/star_decoration.h" | 5 #import "chrome/browser/cocoa/location_bar/star_decoration.h" |
| 6 | 6 |
| 7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
| 8 #include "chrome/app/chrome_dll_resource.h" | 8 #include "chrome/app/chrome_dll_resource.h" |
| 9 #import "chrome/browser/autocomplete/autocomplete_edit_view_mac.h" | 9 #import "chrome/browser/autocomplete/autocomplete_edit_view_mac.h" |
| 10 #include "chrome/browser/command_updater.h" | 10 #include "chrome/browser/command_updater.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 StarDecoration::StarDecoration(CommandUpdater* command_updater) | 23 StarDecoration::StarDecoration(CommandUpdater* command_updater) |
| 24 : command_updater_(command_updater) { | 24 : command_updater_(command_updater) { |
| 25 SetVisible(true); | 25 SetVisible(true); |
| 26 SetStarred(false); | 26 SetStarred(false); |
| 27 } | 27 } |
| 28 | 28 |
| 29 StarDecoration::~StarDecoration() { | 29 StarDecoration::~StarDecoration() { |
| 30 } | 30 } |
| 31 | 31 |
| 32 void StarDecoration::SetStarred(bool starred) { | 32 void StarDecoration::SetStarred(bool starred) { |
| 33 const int image_id = starred ? IDR_OMNIBOX_STAR_LIT : IDR_OMNIBOX_STAR; | 33 const int image_id = starred ? IDR_STAR_LIT : IDR_STAR; |
| 34 const int tip_id = starred ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR; | 34 const int tip_id = starred ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR; |
| 35 SetImage(AutocompleteEditViewMac::ImageForResource(image_id)); | 35 SetImage(AutocompleteEditViewMac::ImageForResource(image_id)); |
| 36 tooltip_.reset([l10n_util::GetNSStringWithFixup(tip_id) retain]); | 36 tooltip_.reset([l10n_util::GetNSStringWithFixup(tip_id) retain]); |
| 37 } | 37 } |
| 38 | 38 |
| 39 NSPoint StarDecoration::GetBubblePointInFrame(NSRect frame) { | 39 NSPoint StarDecoration::GetBubblePointInFrame(NSRect frame) { |
| 40 const NSRect draw_frame = GetDrawRectInFrame(frame); | 40 const NSRect draw_frame = GetDrawRectInFrame(frame); |
| 41 return NSMakePoint(NSMidX(draw_frame), | 41 return NSMakePoint(NSMidX(draw_frame), |
| 42 NSMaxY(draw_frame) - kStarPointYOffset); | 42 NSMaxY(draw_frame) - kStarPointYOffset); |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool StarDecoration::OnMousePressed(NSRect frame) { | 45 bool StarDecoration::OnMousePressed(NSRect frame) { |
| 46 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); | 46 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); |
| 47 return true; | 47 return true; |
| 48 } | 48 } |
| 49 | 49 |
| 50 NSString* StarDecoration::GetToolTip() { | 50 NSString* StarDecoration::GetToolTip() { |
| 51 return tooltip_.get(); | 51 return tooltip_.get(); |
| 52 } | 52 } |
| OLD | NEW |