Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

Issue 10810062: Moving common code into OmniboxView from OmniboxView* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More win fixes Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/location_bar_view_mac.h" 5 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 browser:browser_ 174 browser:browser_
175 profile:profile_]; 175 profile:profile_];
176 } 176 }
177 177
178 string16 LocationBarViewMac::GetInputString() const { 178 string16 LocationBarViewMac::GetInputString() const {
179 return location_input_; 179 return location_input_;
180 } 180 }
181 181
182 void LocationBarViewMac::SetSuggestedText(const string16& text, 182 void LocationBarViewMac::SetSuggestedText(const string16& text,
183 InstantCompleteBehavior behavior) { 183 InstantCompleteBehavior behavior) {
184 omnibox_view_->model()->SetSuggestedText(text, behavior); 184 omnibox_view_->GetModel()->SetSuggestedText(text, behavior);
185 } 185 }
186 186
187 WindowOpenDisposition LocationBarViewMac::GetWindowOpenDisposition() const { 187 WindowOpenDisposition LocationBarViewMac::GetWindowOpenDisposition() const {
188 return disposition_; 188 return disposition_;
189 } 189 }
190 190
191 content::PageTransition LocationBarViewMac::GetPageTransition() const { 191 content::PageTransition LocationBarViewMac::GetPageTransition() const {
192 return transition_; 192 return transition_;
193 } 193 }
194 194
195 void LocationBarViewMac::AcceptInput() { 195 void LocationBarViewMac::AcceptInput() {
196 WindowOpenDisposition disposition = 196 WindowOpenDisposition disposition =
197 event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); 197 event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]);
198 omnibox_view_->model()->AcceptInput(disposition, false); 198 omnibox_view_->GetModel()->AcceptInput(disposition, false);
199 } 199 }
200 200
201 void LocationBarViewMac::FocusLocation(bool select_all) { 201 void LocationBarViewMac::FocusLocation(bool select_all) {
202 omnibox_view_->FocusLocation(select_all); 202 omnibox_view_->FocusLocation(select_all);
203 } 203 }
204 204
205 void LocationBarViewMac::FocusSearch() { 205 void LocationBarViewMac::FocusSearch() {
206 omnibox_view_->SetForcedQuery(); 206 omnibox_view_->SetForcedQuery();
207 } 207 }
208 208
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 664
665 [cell addRightDecoration:keyword_hint_decoration_.get()]; 665 [cell addRightDecoration:keyword_hint_decoration_.get()];
666 666
667 // By default only the location icon is visible. 667 // By default only the location icon is visible.
668 location_icon_decoration_->SetVisible(true); 668 location_icon_decoration_->SetVisible(true);
669 selected_keyword_decoration_->SetVisible(false); 669 selected_keyword_decoration_->SetVisible(false);
670 ev_bubble_decoration_->SetVisible(false); 670 ev_bubble_decoration_->SetVisible(false);
671 keyword_hint_decoration_->SetVisible(false); 671 keyword_hint_decoration_->SetVisible(false);
672 672
673 // Get the keyword to use for keyword-search and hinting. 673 // Get the keyword to use for keyword-search and hinting.
674 const string16 keyword = omnibox_view_->model()->keyword(); 674 const string16 keyword = omnibox_view_->GetModel()->keyword();
675 string16 short_name; 675 string16 short_name;
676 bool is_extension_keyword = false; 676 bool is_extension_keyword = false;
677 if (!keyword.empty()) { 677 if (!keyword.empty()) {
678 short_name = TemplateURLServiceFactory::GetForProfile(profile_)-> 678 short_name = TemplateURLServiceFactory::GetForProfile(profile_)->
679 GetKeywordShortName(keyword, &is_extension_keyword); 679 GetKeywordShortName(keyword, &is_extension_keyword);
680 } 680 }
681 681
682 const bool is_keyword_hint = omnibox_view_->model()->is_keyword_hint(); 682 const bool is_keyword_hint = omnibox_view_->GetModel()->is_keyword_hint();
683 683
684 if (!keyword.empty() && !is_keyword_hint) { 684 if (!keyword.empty() && !is_keyword_hint) {
685 // Switch from location icon to keyword mode. 685 // Switch from location icon to keyword mode.
686 location_icon_decoration_->SetVisible(false); 686 location_icon_decoration_->SetVisible(false);
687 selected_keyword_decoration_->SetVisible(true); 687 selected_keyword_decoration_->SetVisible(true);
688 selected_keyword_decoration_->SetKeyword(short_name, is_extension_keyword); 688 selected_keyword_decoration_->SetKeyword(short_name, is_extension_keyword);
689 selected_keyword_decoration_->SetImage(GetKeywordImage(keyword)); 689 selected_keyword_decoration_->SetImage(GetKeywordImage(keyword));
690 } else if (toolbar_model_->GetSecurityLevel() == ToolbarModel::EV_SECURE) { 690 } else if (toolbar_model_->GetSecurityLevel() == ToolbarModel::EV_SECURE) {
691 // Switch from location icon to show the EV bubble instead. 691 // Switch from location icon to show the EV bubble instead.
692 location_icon_decoration_->SetVisible(false); 692 location_icon_decoration_->SetVisible(false);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 void LocationBarViewMac::UpdateChromeToMobileEnabled() { 728 void LocationBarViewMac::UpdateChromeToMobileEnabled() {
729 if (!chrome_to_mobile_decoration_.get()) 729 if (!chrome_to_mobile_decoration_.get())
730 return; 730 return;
731 731
732 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled()); 732 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled());
733 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() && 733 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() &&
734 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasDevices(); 734 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasDevices();
735 chrome_to_mobile_decoration_->SetVisible(enabled); 735 chrome_to_mobile_decoration_->SetVisible(enabled);
736 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); 736 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled);
737 } 737 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698