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 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h" |
6 | 6 |
7 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 | 139 |
140 bool ZoomDecoration::AcceptsMousePress() { | 140 bool ZoomDecoration::AcceptsMousePress() { |
141 return true; | 141 return true; |
142 } | 142 } |
143 | 143 |
144 bool ZoomDecoration::OnMousePressed(NSRect frame, NSPoint location) { | 144 bool ZoomDecoration::OnMousePressed(NSRect frame, NSPoint location) { |
145 if (bubble_) | 145 if (bubble_) |
146 CloseBubble(); | 146 CloseBubble(); |
147 else | 147 else |
148 ShowBubble(NO); | 148 ShowBubble(YES); |
149 return true; | 149 return true; |
150 } | 150 } |
151 | 151 |
152 NSString* ZoomDecoration::GetToolTip() { | 152 NSString* ZoomDecoration::GetToolTip() { |
153 return tooltip_.get(); | 153 return tooltip_.get(); |
154 } | 154 } |
155 | 155 |
156 content::WebContents* ZoomDecoration::GetWebContents() { | 156 content::WebContents* ZoomDecoration::GetWebContents() { |
157 return owner_->GetWebContents(); | 157 return owner_->GetWebContents(); |
158 } | 158 } |
159 | 159 |
160 void ZoomDecoration::OnClose() { | 160 void ZoomDecoration::OnClose() { |
161 bubble_.delegate = nil; | 161 bubble_.delegate = nil; |
162 bubble_ = nil; | 162 bubble_ = nil; |
163 | 163 |
164 // If the page is at default zoom then hiding the zoom decoration | 164 // If the page is at default zoom then hiding the zoom decoration |
165 // was suppressed while the bubble was open. Now that the bubble is | 165 // was suppressed while the bubble was open. Now that the bubble is |
166 // closed the decoration can be hidden. | 166 // closed the decoration can be hidden. |
167 if (IsAtDefaultZoom() && IsVisible()) { | 167 if (IsAtDefaultZoom() && IsVisible()) { |
168 SetVisible(false); | 168 SetVisible(false); |
169 owner_->OnDecorationsChanged(); | 169 owner_->OnDecorationsChanged(); |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 gfx::VectorIconId ZoomDecoration::GetMaterialVectorIconId() const { | 173 gfx::VectorIconId ZoomDecoration::GetMaterialVectorIconId() const { |
174 return vector_icon_id_; | 174 return vector_icon_id_; |
175 } | 175 } |
OLD | NEW |