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/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" | 10 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 bool ZoomDecoration::ShouldShowDecoration() const { | 88 bool ZoomDecoration::ShouldShowDecoration() const { |
89 return owner_->GetWebContents() != NULL && | 89 return owner_->GetWebContents() != NULL && |
90 !owner_->GetToolbarModel()->input_in_progress() && | 90 !owner_->GetToolbarModel()->input_in_progress() && |
91 (bubble_ || !IsAtDefaultZoom()); | 91 (bubble_ || !IsAtDefaultZoom()); |
92 } | 92 } |
93 | 93 |
94 bool ZoomDecoration::AcceptsMousePress() { | 94 bool ZoomDecoration::AcceptsMousePress() { |
95 return true; | 95 return true; |
96 } | 96 } |
97 | 97 |
98 bool ZoomDecoration::OnMousePressed(NSRect frame) { | 98 bool ZoomDecoration::OnMousePressed(NSRect frame, NSPoint location) { |
99 if (bubble_) | 99 if (bubble_) |
100 CloseBubble(); | 100 CloseBubble(); |
101 else | 101 else |
102 ShowBubble(NO); | 102 ShowBubble(NO); |
103 return true; | 103 return true; |
104 } | 104 } |
105 | 105 |
106 NSString* ZoomDecoration::GetToolTip() { | 106 NSString* ZoomDecoration::GetToolTip() { |
107 return tooltip_.get(); | 107 return tooltip_.get(); |
108 } | 108 } |
109 | 109 |
110 content::WebContents* ZoomDecoration::GetWebContents() { | 110 content::WebContents* ZoomDecoration::GetWebContents() { |
111 return owner_->GetWebContents(); | 111 return owner_->GetWebContents(); |
112 } | 112 } |
113 | 113 |
114 void ZoomDecoration::OnClose() { | 114 void ZoomDecoration::OnClose() { |
115 bubble_ = nil; | 115 bubble_ = nil; |
116 | 116 |
117 // If the page is at default zoom then hiding the zoom decoration | 117 // If the page is at default zoom then hiding the zoom decoration |
118 // was suppressed while the bubble was open. Now that the bubble is | 118 // was suppressed while the bubble was open. Now that the bubble is |
119 // closed the decoration can be hidden. | 119 // closed the decoration can be hidden. |
120 if (IsAtDefaultZoom() && IsVisible()) { | 120 if (IsAtDefaultZoom() && IsVisible()) { |
121 SetVisible(false); | 121 SetVisible(false); |
122 owner_->OnDecorationsChanged(); | 122 owner_->OnDecorationsChanged(); |
123 } | 123 } |
124 } | 124 } |
OLD | NEW |