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 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
6 | 6 |
7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_R, | 108 IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_R, |
109 }; | 109 }; |
110 | 110 |
111 // Height of the location bar's round corner region. | 111 // Height of the location bar's round corner region. |
112 static const int kBorderRoundCornerHeight = 6; | 112 static const int kBorderRoundCornerHeight = 6; |
113 // Width of location bar's round corner region. | 113 // Width of location bar's round corner region. |
114 static const int kBorderRoundCornerWidth = 5; | 114 static const int kBorderRoundCornerWidth = 5; |
115 | 115 |
116 // LocationBarView ----------------------------------------------------------- | 116 // LocationBarView ----------------------------------------------------------- |
117 | 117 |
118 LocationBarView::LocationBarView(Browser* browser, | 118 LocationBarView::LocationBarView(Profile* profile, |
| 119 CommandUpdater* command_updater, |
119 ToolbarModel* model, | 120 ToolbarModel* model, |
120 Delegate* delegate, | 121 Delegate* delegate, |
121 Mode mode) | 122 Mode mode) |
122 : browser_(browser), | 123 : profile_(profile), |
| 124 command_updater_(command_updater), |
123 model_(model), | 125 model_(model), |
124 delegate_(delegate), | 126 delegate_(delegate), |
125 disposition_(CURRENT_TAB), | 127 disposition_(CURRENT_TAB), |
126 transition_(content::PageTransitionFromInt( | 128 transition_(content::PageTransitionFromInt( |
127 content::PAGE_TRANSITION_TYPED | | 129 content::PAGE_TRANSITION_TYPED | |
128 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)), | 130 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)), |
129 location_icon_view_(NULL), | 131 location_icon_view_(NULL), |
130 ev_bubble_view_(NULL), | 132 ev_bubble_view_(NULL), |
131 location_entry_view_(NULL), | 133 location_entry_view_(NULL), |
132 selected_keyword_view_(NULL), | 134 selected_keyword_view_(NULL), |
(...skipping 12 matching lines...) Expand all Loading... |
145 painter_.reset( | 147 painter_.reset( |
146 views::Painter::CreateImagePainter( | 148 views::Painter::CreateImagePainter( |
147 *ResourceBundle::GetSharedInstance().GetImageNamed( | 149 *ResourceBundle::GetSharedInstance().GetImageNamed( |
148 IDR_LOCATION_BAR_BORDER).ToSkBitmap(), | 150 IDR_LOCATION_BAR_BORDER).ToSkBitmap(), |
149 gfx::Insets(kBorderRoundCornerHeight, kBorderRoundCornerWidth, | 151 gfx::Insets(kBorderRoundCornerHeight, kBorderRoundCornerWidth, |
150 kBorderRoundCornerHeight, kBorderRoundCornerWidth), | 152 kBorderRoundCornerHeight, kBorderRoundCornerWidth), |
151 true)); | 153 true)); |
152 } | 154 } |
153 | 155 |
154 edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled, | 156 edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled, |
155 browser_->profile()->GetPrefs(), this); | 157 profile_->GetPrefs(), this); |
156 } | 158 } |
157 | 159 |
158 LocationBarView::~LocationBarView() { | 160 LocationBarView::~LocationBarView() { |
159 if (template_url_service_) | 161 if (template_url_service_) |
160 template_url_service_->RemoveObserver(this); | 162 template_url_service_->RemoveObserver(this); |
161 } | 163 } |
162 | 164 |
163 void LocationBarView::Init() { | 165 void LocationBarView::Init() { |
164 if (mode_ == POPUP) { | 166 if (mode_ == POPUP) { |
165 font_ = ResourceBundle::GetSharedInstance().GetFont( | 167 font_ = ResourceBundle::GetSharedInstance().GetFont( |
(...skipping 17 matching lines...) Expand all Loading... |
183 | 185 |
184 ev_bubble_view_ = | 186 ev_bubble_view_ = |
185 new EVBubbleView(kEVBubbleBackgroundImages, IDR_OMNIBOX_HTTPS_VALID, | 187 new EVBubbleView(kEVBubbleBackgroundImages, IDR_OMNIBOX_HTTPS_VALID, |
186 GetColor(ToolbarModel::EV_SECURE, SECURITY_TEXT), this); | 188 GetColor(ToolbarModel::EV_SECURE, SECURITY_TEXT), this); |
187 AddChildView(ev_bubble_view_); | 189 AddChildView(ev_bubble_view_); |
188 ev_bubble_view_->SetVisible(false); | 190 ev_bubble_view_->SetVisible(false); |
189 ev_bubble_view_->set_drag_controller(this); | 191 ev_bubble_view_->set_drag_controller(this); |
190 | 192 |
191 // URL edit field. | 193 // URL edit field. |
192 // View container for URL edit field. | 194 // View container for URL edit field. |
193 Profile* profile = browser_->profile(); | |
194 location_entry_.reset(OmniboxView::CreateOmniboxView( | 195 location_entry_.reset(OmniboxView::CreateOmniboxView( |
195 this, | 196 this, |
196 model_, | 197 model_, |
197 profile, | 198 profile_, |
198 browser_->command_updater(), | 199 command_updater_, |
199 mode_ == POPUP, | 200 mode_ == POPUP, |
200 this)); | 201 this)); |
201 SetLocationEntryFocusable(true); | 202 SetLocationEntryFocusable(true); |
202 | 203 |
203 location_entry_view_ = location_entry_->AddToView(this); | 204 location_entry_view_ = location_entry_->AddToView(this); |
204 location_entry_view_->set_id(VIEW_ID_AUTOCOMPLETE); | 205 location_entry_view_->set_id(VIEW_ID_AUTOCOMPLETE); |
205 | 206 |
206 selected_keyword_view_ = new SelectedKeywordView( | 207 selected_keyword_view_ = new SelectedKeywordView( |
207 kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER, | 208 kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER, |
208 GetColor(ToolbarModel::NONE, TEXT), profile); | 209 GetColor(ToolbarModel::NONE, TEXT), profile_); |
209 AddChildView(selected_keyword_view_); | 210 AddChildView(selected_keyword_view_); |
210 selected_keyword_view_->SetFont(font_); | 211 selected_keyword_view_->SetFont(font_); |
211 selected_keyword_view_->SetVisible(false); | 212 selected_keyword_view_->SetVisible(false); |
212 | 213 |
213 keyword_hint_view_ = new KeywordHintView(profile); | 214 keyword_hint_view_ = new KeywordHintView(profile_); |
214 AddChildView(keyword_hint_view_); | 215 AddChildView(keyword_hint_view_); |
215 keyword_hint_view_->SetVisible(false); | 216 keyword_hint_view_->SetVisible(false); |
216 keyword_hint_view_->SetFont(font_); | 217 keyword_hint_view_->SetFont(font_); |
217 | 218 |
218 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 219 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
219 ContentSettingImageView* content_blocked_view = | 220 ContentSettingImageView* content_blocked_view = |
220 new ContentSettingImageView(static_cast<ContentSettingsType>(i), this); | 221 new ContentSettingImageView( |
| 222 static_cast<ContentSettingsType>(i), |
| 223 this); |
221 content_setting_views_.push_back(content_blocked_view); | 224 content_setting_views_.push_back(content_blocked_view); |
222 AddChildView(content_blocked_view); | 225 AddChildView(content_blocked_view); |
223 content_blocked_view->SetVisible(false); | 226 content_blocked_view->SetVisible(false); |
224 } | 227 } |
225 | 228 |
226 // The star is not visible in popups and in the app launcher. | 229 // The star is not visible in popups and in the app launcher. |
227 if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { | 230 if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { |
228 star_view_ = new StarView(browser_->command_updater()); | 231 star_view_ = new StarView(command_updater_); |
229 AddChildView(star_view_); | 232 AddChildView(star_view_); |
230 star_view_->SetVisible(true); | 233 star_view_->SetVisible(true); |
231 } | 234 } |
232 | 235 |
233 // Initialize the location entry. We do this to avoid a black flash which is | 236 // Initialize the location entry. We do this to avoid a black flash which is |
234 // visible when the location entry has just been initialized. | 237 // visible when the location entry has just been initialized. |
235 Update(NULL); | 238 Update(NULL); |
236 | 239 |
237 OnChanged(); | 240 OnChanged(); |
238 } | 241 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 FocusLocation(select_all); | 298 FocusLocation(select_all); |
296 } | 299 } |
297 | 300 |
298 void LocationBarView::SetAnimationOffset(int offset) { | 301 void LocationBarView::SetAnimationOffset(int offset) { |
299 animation_offset_ = offset; | 302 animation_offset_ = offset; |
300 } | 303 } |
301 | 304 |
302 void LocationBarView::Update(const WebContents* tab_for_state_restoring) { | 305 void LocationBarView::Update(const WebContents* tab_for_state_restoring) { |
303 bool star_enabled = star_view_ && !model_->input_in_progress() && | 306 bool star_enabled = star_view_ && !model_->input_in_progress() && |
304 edit_bookmarks_enabled_.GetValue(); | 307 edit_bookmarks_enabled_.GetValue(); |
305 browser_->command_updater()->UpdateCommandEnabled( | 308 command_updater_->UpdateCommandEnabled( |
306 IDC_BOOKMARK_PAGE, star_enabled); | 309 IDC_BOOKMARK_PAGE, star_enabled); |
307 if (star_view_) | 310 if (star_view_) |
308 star_view_->SetVisible(star_enabled); | 311 star_view_->SetVisible(star_enabled); |
309 RefreshContentSettingViews(); | 312 RefreshContentSettingViews(); |
310 RefreshPageActionViews(); | 313 RefreshPageActionViews(); |
311 // Don't Update in app launcher mode so that the location entry does not show | 314 // Don't Update in app launcher mode so that the location entry does not show |
312 // a URL or security background. | 315 // a URL or security background. |
313 if (mode_ != APP_LAUNCHER) | 316 if (mode_ != APP_LAUNCHER) |
314 location_entry_->Update(tab_for_state_restoring); | 317 location_entry_->Update(tab_for_state_restoring); |
315 OnChanged(); | 318 OnChanged(); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 } | 394 } |
392 return NULL; | 395 return NULL; |
393 } | 396 } |
394 | 397 |
395 void LocationBarView::SetStarToggled(bool on) { | 398 void LocationBarView::SetStarToggled(bool on) { |
396 if (star_view_) | 399 if (star_view_) |
397 star_view_->SetToggled(on); | 400 star_view_->SetToggled(on); |
398 } | 401 } |
399 | 402 |
400 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { | 403 void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) { |
401 browser::ShowBookmarkBubbleView(star_view_, browser_->profile(), url, | 404 browser::ShowBookmarkBubbleView(star_view_, profile_, url, |
402 newly_bookmarked); | 405 newly_bookmarked); |
403 } | 406 } |
404 | 407 |
405 gfx::Point LocationBarView::GetLocationEntryOrigin() const { | 408 gfx::Point LocationBarView::GetLocationEntryOrigin() const { |
406 gfx::Point origin(location_entry_view_->bounds().origin()); | 409 gfx::Point origin(location_entry_view_->bounds().origin()); |
407 // If the UI layout is RTL, the coordinate system is not transformed and | 410 // If the UI layout is RTL, the coordinate system is not transformed and |
408 // therefore we need to adjust the X coordinate so that bubble appears on the | 411 // therefore we need to adjust the X coordinate so that bubble appears on the |
409 // right hand side of the location bar. | 412 // right hand side of the location bar. |
410 if (base::i18n::IsRTL()) | 413 if (base::i18n::IsRTL()) |
411 origin.set_x(width() - origin.x()); | 414 origin.set_x(width() - origin.x()); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 if (max_edit_width < 0) | 560 if (max_edit_width < 0) |
558 return; | 561 return; |
559 const int available_width = AvailableWidth(max_edit_width); | 562 const int available_width = AvailableWidth(max_edit_width); |
560 | 563 |
561 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint; | 564 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint; |
562 selected_keyword_view_->SetVisible(show_selected_keyword); | 565 selected_keyword_view_->SetVisible(show_selected_keyword); |
563 keyword_hint_view_->SetVisible(show_keyword_hint); | 566 keyword_hint_view_->SetVisible(show_keyword_hint); |
564 if (show_selected_keyword) { | 567 if (show_selected_keyword) { |
565 if (selected_keyword_view_->keyword() != keyword) { | 568 if (selected_keyword_view_->keyword() != keyword) { |
566 selected_keyword_view_->SetKeyword(keyword); | 569 selected_keyword_view_->SetKeyword(keyword); |
567 Profile* profile = browser_->profile(); | |
568 const TemplateURL* template_url = | 570 const TemplateURL* template_url = |
569 TemplateURLServiceFactory::GetForProfile(profile)-> | 571 TemplateURLServiceFactory::GetForProfile(profile_)-> |
570 GetTemplateURLForKeyword(keyword); | 572 GetTemplateURLForKeyword(keyword); |
571 if (template_url && template_url->IsExtensionKeyword()) { | 573 if (template_url && template_url->IsExtensionKeyword()) { |
572 const SkBitmap& bitmap = profile->GetExtensionService()->GetOmniboxIcon( | 574 const SkBitmap& bitmap = |
573 template_url->GetExtensionId()); | 575 profile_->GetExtensionService()->GetOmniboxIcon( |
| 576 template_url->GetExtensionId()); |
574 selected_keyword_view_->SetImage(bitmap); | 577 selected_keyword_view_->SetImage(bitmap); |
575 selected_keyword_view_->set_is_extension_icon(true); | 578 selected_keyword_view_->set_is_extension_icon(true); |
576 } else { | 579 } else { |
577 selected_keyword_view_->SetImage(*ResourceBundle::GetSharedInstance(). | 580 selected_keyword_view_->SetImage(*ResourceBundle::GetSharedInstance(). |
578 GetBitmapNamed(IDR_OMNIBOX_SEARCH)); | 581 GetBitmapNamed(IDR_OMNIBOX_SEARCH)); |
579 selected_keyword_view_->set_is_extension_icon(false); | 582 selected_keyword_view_->set_is_extension_icon(false); |
580 } | 583 } |
581 } | 584 } |
582 } else if (show_keyword_hint) { | 585 } else if (show_keyword_hint) { |
583 if (keyword_hint_view_->keyword() != keyword) | 586 if (keyword_hint_view_->keyword() != keyword) |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 content::PageTransition transition, | 814 content::PageTransition transition, |
812 const GURL& alternate_nav_url) { | 815 const GURL& alternate_nav_url) { |
813 // WARNING: don't add an early return here. The calls after the if must | 816 // WARNING: don't add an early return here. The calls after the if must |
814 // happen. | 817 // happen. |
815 if (url.is_valid()) { | 818 if (url.is_valid()) { |
816 location_input_ = UTF8ToUTF16(url.spec()); | 819 location_input_ = UTF8ToUTF16(url.spec()); |
817 disposition_ = disposition; | 820 disposition_ = disposition; |
818 transition_ = content::PageTransitionFromInt( | 821 transition_ = content::PageTransitionFromInt( |
819 transition | content::PAGE_TRANSITION_FROM_ADDRESS_BAR); | 822 transition | content::PAGE_TRANSITION_FROM_ADDRESS_BAR); |
820 | 823 |
821 if (browser_->command_updater()) { | 824 if (command_updater_) { |
822 if (!alternate_nav_url.is_valid()) { | 825 if (!alternate_nav_url.is_valid()) { |
823 browser_->command_updater()->ExecuteCommand(IDC_OPEN_CURRENT_URL); | 826 command_updater_->ExecuteCommand(IDC_OPEN_CURRENT_URL); |
824 } else { | 827 } else { |
825 AlternateNavURLFetcher* fetcher = | 828 AlternateNavURLFetcher* fetcher = |
826 new AlternateNavURLFetcher(alternate_nav_url); | 829 new AlternateNavURLFetcher(alternate_nav_url); |
827 // The AlternateNavURLFetcher will listen for the pending navigation | 830 // The AlternateNavURLFetcher will listen for the pending navigation |
828 // notification that will be issued as a result of the "open URL." It | 831 // notification that will be issued as a result of the "open URL." It |
829 // will automatically install itself into that navigation controller. | 832 // will automatically install itself into that navigation controller. |
830 browser_->command_updater()->ExecuteCommand(IDC_OPEN_CURRENT_URL); | 833 command_updater_->ExecuteCommand(IDC_OPEN_CURRENT_URL); |
831 if (fetcher->state() == AlternateNavURLFetcher::NOT_STARTED) { | 834 if (fetcher->state() == AlternateNavURLFetcher::NOT_STARTED) { |
832 // I'm not sure this should be reachable, but I'm not also sure enough | 835 // I'm not sure this should be reachable, but I'm not also sure enough |
833 // that it shouldn't to stick in a NOTREACHED(). In any case, this is | 836 // that it shouldn't to stick in a NOTREACHED(). In any case, this is |
834 // harmless. | 837 // harmless. |
835 delete fetcher; | 838 delete fetcher; |
836 } else { | 839 } else { |
837 // The navigation controller will delete the fetcher. | 840 // The navigation controller will delete the fetcher. |
838 } | 841 } |
839 } | 842 } |
840 } | 843 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 for (PageActionViews::const_iterator i(page_action_views_.begin()); | 930 for (PageActionViews::const_iterator i(page_action_views_.begin()); |
928 i != page_action_views_.end(); ++i) | 931 i != page_action_views_.end(); ++i) |
929 RemoveChildView(*i); | 932 RemoveChildView(*i); |
930 STLDeleteElements(&page_action_views_); | 933 STLDeleteElements(&page_action_views_); |
931 } | 934 } |
932 | 935 |
933 void LocationBarView::RefreshPageActionViews() { | 936 void LocationBarView::RefreshPageActionViews() { |
934 if (mode_ != NORMAL) | 937 if (mode_ != NORMAL) |
935 return; | 938 return; |
936 | 939 |
937 ExtensionService* service = browser_->profile()->GetExtensionService(); | 940 ExtensionService* service = profile_->GetExtensionService(); |
938 if (!service) | 941 if (!service) |
939 return; | 942 return; |
940 | 943 |
941 std::map<ExtensionAction*, bool> old_visibility; | 944 std::map<ExtensionAction*, bool> old_visibility; |
942 for (PageActionViews::const_iterator i(page_action_views_.begin()); | 945 for (PageActionViews::const_iterator i(page_action_views_.begin()); |
943 i != page_action_views_.end(); ++i) | 946 i != page_action_views_.end(); ++i) |
944 old_visibility[(*i)->image_view()->page_action()] = (*i)->visible(); | 947 old_visibility[(*i)->image_view()->page_action()] = (*i)->visible(); |
945 | 948 |
946 // Remember the previous visibility of the page actions so that we can | 949 // Remember the previous visibility of the page actions so that we can |
947 // notify when this changes. | 950 // notify when this changes. |
948 std::vector<ExtensionAction*> page_actions; | 951 std::vector<ExtensionAction*> page_actions; |
949 for (ExtensionSet::const_iterator it = service->extensions()->begin(); | 952 for (ExtensionSet::const_iterator it = service->extensions()->begin(); |
950 it != service->extensions()->end(); ++it) { | 953 it != service->extensions()->end(); ++it) { |
951 if ((*it)->page_action()) | 954 if ((*it)->page_action()) |
952 page_actions.push_back((*it)->page_action()); | 955 page_actions.push_back((*it)->page_action()); |
953 } | 956 } |
954 | 957 |
955 // On startup we sometimes haven't loaded any extensions. This makes sure | 958 // On startup we sometimes haven't loaded any extensions. This makes sure |
956 // we catch up when the extensions (and any page actions) load. | 959 // we catch up when the extensions (and any page actions) load. |
957 if (page_actions.size() != page_action_views_.size()) { | 960 if (page_actions.size() != page_action_views_.size()) { |
958 DeletePageActionViews(); // Delete the old views (if any). | 961 DeletePageActionViews(); // Delete the old views (if any). |
959 | 962 |
960 page_action_views_.resize(page_actions.size()); | 963 page_action_views_.resize(page_actions.size()); |
961 | 964 |
962 // Add the page actions in reverse order, so that the child views are | 965 // Add the page actions in reverse order, so that the child views are |
963 // inserted in left-to-right order for accessibility. | 966 // inserted in left-to-right order for accessibility. |
964 for (int i = page_actions.size() - 1; i >= 0; --i) { | 967 for (int i = page_actions.size() - 1; i >= 0; --i) { |
965 page_action_views_[i] = new PageActionWithBadgeView( | 968 page_action_views_[i] = new PageActionWithBadgeView( |
966 new PageActionImageView(this, page_actions[i])); | 969 delegate_->CreatePageActionImageView(this, page_actions[i])); |
967 page_action_views_[i]->SetVisible(false); | 970 page_action_views_[i]->SetVisible(false); |
968 AddChildViewAt(page_action_views_[i], GetIndexOf(star_view_)); | 971 AddChildViewAt(page_action_views_[i], GetIndexOf(star_view_)); |
969 } | 972 } |
970 } | 973 } |
971 | 974 |
972 WebContents* contents = GetWebContentsFromDelegate(delegate_); | 975 WebContents* contents = GetWebContentsFromDelegate(delegate_); |
973 if (!page_action_views_.empty() && contents) { | 976 if (!page_action_views_.empty() && contents) { |
974 GURL url = GURL(model_->GetText()); | 977 GURL url = GURL(model_->GetText()); |
975 | 978 |
976 for (PageActionViews::const_iterator i(page_action_views_.begin()); | 979 for (PageActionViews::const_iterator i(page_action_views_.begin()); |
(...skipping 22 matching lines...) Expand all Loading... |
999 if (views::Widget::IsPureViews()) | 1002 if (views::Widget::IsPureViews()) |
1000 NOTIMPLEMENTED(); | 1003 NOTIMPLEMENTED(); |
1001 else | 1004 else |
1002 GetOmniboxViewWin()->HandleExternalMsg(msg, flags, screen_point.ToPOINT()); | 1005 GetOmniboxViewWin()->HandleExternalMsg(msg, flags, screen_point.ToPOINT()); |
1003 } | 1006 } |
1004 #endif | 1007 #endif |
1005 | 1008 |
1006 void LocationBarView::ShowFirstRunBubbleInternal() { | 1009 void LocationBarView::ShowFirstRunBubbleInternal() { |
1007 #if !defined(OS_CHROMEOS) | 1010 #if !defined(OS_CHROMEOS) |
1008 // First run bubble doesn't make sense for Chrome OS. | 1011 // First run bubble doesn't make sense for Chrome OS. |
1009 FirstRunBubble::ShowBubble(browser_->profile(), location_icon_view_); | 1012 FirstRunBubble::ShowBubble(profile_, location_icon_view_); |
1010 #endif | 1013 #endif |
1011 } | 1014 } |
1012 | 1015 |
1013 std::string LocationBarView::GetClassName() const { | 1016 std::string LocationBarView::GetClassName() const { |
1014 return kViewClassName; | 1017 return kViewClassName; |
1015 } | 1018 } |
1016 | 1019 |
1017 bool LocationBarView::SkipDefaultKeyEventProcessing( | 1020 bool LocationBarView::SkipDefaultKeyEventProcessing( |
1018 const views::KeyEvent& event) { | 1021 const views::KeyEvent& event) { |
1019 #if defined(OS_WIN) | 1022 #if defined(OS_WIN) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 const gfx::Point& p) { | 1092 const gfx::Point& p) { |
1090 return true; | 1093 return true; |
1091 } | 1094 } |
1092 | 1095 |
1093 //////////////////////////////////////////////////////////////////////////////// | 1096 //////////////////////////////////////////////////////////////////////////////// |
1094 // LocationBarView, LocationBar implementation: | 1097 // LocationBarView, LocationBar implementation: |
1095 | 1098 |
1096 void LocationBarView::ShowFirstRunBubble() { | 1099 void LocationBarView::ShowFirstRunBubble() { |
1097 // Wait until search engines have loaded to show the first run bubble. | 1100 // Wait until search engines have loaded to show the first run bubble. |
1098 TemplateURLService* url_service = | 1101 TemplateURLService* url_service = |
1099 TemplateURLServiceFactory::GetForProfile(browser_->profile()); | 1102 TemplateURLServiceFactory::GetForProfile(profile_); |
1100 if (!url_service->loaded()) { | 1103 if (!url_service->loaded()) { |
1101 template_url_service_ = url_service; | 1104 template_url_service_ = url_service; |
1102 template_url_service_->AddObserver(this); | 1105 template_url_service_->AddObserver(this); |
1103 template_url_service_->Load(); | 1106 template_url_service_->Load(); |
1104 return; | 1107 return; |
1105 } | 1108 } |
1106 ShowFirstRunBubbleInternal(); | 1109 ShowFirstRunBubbleInternal(); |
1107 } | 1110 } |
1108 | 1111 |
1109 void LocationBarView::SetSuggestedText(const string16& text, | 1112 void LocationBarView::SetSuggestedText(const string16& text, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 !suggested_text_view_->GetText().empty(); | 1239 !suggested_text_view_->GetText().empty(); |
1237 } | 1240 } |
1238 | 1241 |
1239 #if !defined(USE_AURA) | 1242 #if !defined(USE_AURA) |
1240 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { | 1243 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { |
1241 CHECK(!views::Widget::IsPureViews()); | 1244 CHECK(!views::Widget::IsPureViews()); |
1242 return static_cast<OmniboxViewWin*>(location_entry_.get()); | 1245 return static_cast<OmniboxViewWin*>(location_entry_.get()); |
1243 } | 1246 } |
1244 #endif | 1247 #endif |
1245 #endif | 1248 #endif |
OLD | NEW |