OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/location_bar_view_mac.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // set by their top arrow. Because the BaseBubbleController adjusts the | 131 // set by their top arrow. Because the BaseBubbleController adjusts the |
132 // window origin left to account for the arrow spacing, the first run bubble | 132 // window origin left to account for the arrow spacing, the first run bubble |
133 // moves the window origin right by this spacing, so that the | 133 // moves the window origin right by this spacing, so that the |
134 // BaseBubbleController will move it back to the correct position. | 134 // BaseBubbleController will move it back to the correct position. |
135 const NSPoint kOffset = NSMakePoint( | 135 const NSPoint kOffset = NSMakePoint( |
136 info_bubble::kBubbleArrowXOffset + info_bubble::kBubbleArrowWidth/2.0, | 136 info_bubble::kBubbleArrowXOffset + info_bubble::kBubbleArrowWidth/2.0, |
137 kFirstRunBubbleYOffset); | 137 kFirstRunBubbleYOffset); |
138 [FirstRunBubbleController showForView:field_ offset:kOffset profile:profile_]; | 138 [FirstRunBubbleController showForView:field_ offset:kOffset profile:profile_]; |
139 } | 139 } |
140 | 140 |
141 std::wstring LocationBarViewMac::GetInputString() const { | 141 string16 LocationBarViewMac::GetInputString() const { |
142 return location_input_; | 142 return location_input_; |
143 } | 143 } |
144 | 144 |
145 void LocationBarViewMac::SetSuggestedText(const string16& text, | 145 void LocationBarViewMac::SetSuggestedText(const string16& text, |
146 InstantCompleteBehavior behavior) { | 146 InstantCompleteBehavior behavior) { |
147 omnibox_view_->model()->SetSuggestedText(text, behavior); | 147 omnibox_view_->model()->SetSuggestedText(text, behavior); |
148 } | 148 } |
149 | 149 |
150 WindowOpenDisposition LocationBarViewMac::GetWindowOpenDisposition() const { | 150 WindowOpenDisposition LocationBarViewMac::GetWindowOpenDisposition() const { |
151 return disposition_; | 151 return disposition_; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 OnChanged(); | 217 OnChanged(); |
218 } | 218 } |
219 | 219 |
220 void LocationBarViewMac::OnAutocompleteAccept(const GURL& url, | 220 void LocationBarViewMac::OnAutocompleteAccept(const GURL& url, |
221 WindowOpenDisposition disposition, | 221 WindowOpenDisposition disposition, |
222 PageTransition::Type transition, | 222 PageTransition::Type transition, |
223 const GURL& alternate_nav_url) { | 223 const GURL& alternate_nav_url) { |
224 // WARNING: don't add an early return here. The calls after the if must | 224 // WARNING: don't add an early return here. The calls after the if must |
225 // happen. | 225 // happen. |
226 if (url.is_valid()) { | 226 if (url.is_valid()) { |
227 location_input_ = UTF8ToWide(url.spec()); | 227 location_input_ = UTF8ToUTF16(url.spec()); |
228 disposition_ = disposition; | 228 disposition_ = disposition; |
229 transition_ = transition; | 229 transition_ = transition; |
230 | 230 |
231 if (command_updater_) { | 231 if (command_updater_) { |
232 if (!alternate_nav_url.is_valid()) { | 232 if (!alternate_nav_url.is_valid()) { |
233 command_updater_->ExecuteCommand(IDC_OPEN_CURRENT_URL); | 233 command_updater_->ExecuteCommand(IDC_OPEN_CURRENT_URL); |
234 } else { | 234 } else { |
235 AlternateNavURLFetcher* fetcher = | 235 AlternateNavURLFetcher* fetcher = |
236 new AlternateNavURLFetcher(alternate_nav_url); | 236 new AlternateNavURLFetcher(alternate_nav_url); |
237 // The AlternateNavURLFetcher will listen for the pending navigation | 237 // The AlternateNavURLFetcher will listen for the pending navigation |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 | 637 |
638 [field_ setNeedsDisplay:YES]; | 638 [field_ setNeedsDisplay:YES]; |
639 } | 639 } |
640 | 640 |
641 bool LocationBarViewMac::IsStarEnabled() { | 641 bool LocationBarViewMac::IsStarEnabled() { |
642 return [field_ isEditable] && | 642 return [field_ isEditable] && |
643 browser_defaults::bookmarks_enabled && | 643 browser_defaults::bookmarks_enabled && |
644 !toolbar_model_->input_in_progress() && | 644 !toolbar_model_->input_in_progress() && |
645 edit_bookmarks_enabled_.GetValue(); | 645 edit_bookmarks_enabled_.GetValue(); |
646 } | 646 } |
OLD | NEW |