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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 new SelectedKeywordDecoration(OmniboxViewMac::GetFieldFont())), | 84 new SelectedKeywordDecoration(OmniboxViewMac::GetFieldFont())), |
85 ev_bubble_decoration_( | 85 ev_bubble_decoration_( |
86 new EVBubbleDecoration(location_icon_decoration_.get(), | 86 new EVBubbleDecoration(location_icon_decoration_.get(), |
87 OmniboxViewMac::GetFieldFont())), | 87 OmniboxViewMac::GetFieldFont())), |
88 star_decoration_(new StarDecoration(command_updater)), | 88 star_decoration_(new StarDecoration(command_updater)), |
89 keyword_hint_decoration_( | 89 keyword_hint_decoration_( |
90 new KeywordHintDecoration(OmniboxViewMac::GetFieldFont())), | 90 new KeywordHintDecoration(OmniboxViewMac::GetFieldFont())), |
91 profile_(profile), | 91 profile_(profile), |
92 browser_(browser), | 92 browser_(browser), |
93 toolbar_model_(toolbar_model), | 93 toolbar_model_(toolbar_model), |
94 transition_(PageTransition::TYPED), | 94 transition_(PageTransition::TYPED | PageTransition::FROM_ADDRESS_BAR), |
95 first_run_bubble_(this) { | 95 first_run_bubble_(this) { |
96 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 96 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
97 DCHECK_EQ(i, content_setting_decorations_.size()); | 97 DCHECK_EQ(i, content_setting_decorations_.size()); |
98 ContentSettingsType type = static_cast<ContentSettingsType>(i); | 98 ContentSettingsType type = static_cast<ContentSettingsType>(i); |
99 content_setting_decorations_.push_back( | 99 content_setting_decorations_.push_back( |
100 new ContentSettingDecoration(type, this, profile_)); | 100 new ContentSettingDecoration(type, this, profile_)); |
101 } | 101 } |
102 | 102 |
103 registrar_.Add(this, | 103 registrar_.Add(this, |
104 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, | 104 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_ = UTF8ToUTF16(url.spec()); | 227 location_input_ = UTF8ToUTF16(url.spec()); |
228 disposition_ = disposition; | 228 disposition_ = disposition; |
229 transition_ = transition; | 229 transition_ = transition | PageTransition::FROM_ADDRESS_BAR; |
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 |
238 // notification that will be issued as a result of the "open URL." It | 238 // notification that will be issued as a result of the "open URL." It |
239 // will automatically install itself into that navigation controller. | 239 // will automatically install itself into that navigation controller. |
(...skipping 397 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 |