| 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 #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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 location_entry_view_(NULL), | 113 location_entry_view_(NULL), |
| 114 selected_keyword_view_(NULL), | 114 selected_keyword_view_(NULL), |
| 115 #if defined(OS_WIN) | 115 #if defined(OS_WIN) |
| 116 suggested_text_view_(NULL), | 116 suggested_text_view_(NULL), |
| 117 #endif | 117 #endif |
| 118 keyword_hint_view_(NULL), | 118 keyword_hint_view_(NULL), |
| 119 star_view_(NULL), | 119 star_view_(NULL), |
| 120 mode_(mode), | 120 mode_(mode), |
| 121 show_focus_rect_(false), | 121 show_focus_rect_(false), |
| 122 bubble_type_(FirstRun::MINIMAL_BUBBLE), | 122 bubble_type_(FirstRun::MINIMAL_BUBBLE), |
| 123 template_url_model_(NULL) { | 123 template_url_model_(NULL), |
| 124 animation_offset_(0) { |
| 124 DCHECK(profile_); | 125 DCHECK(profile_); |
| 125 SetID(VIEW_ID_LOCATION_BAR); | 126 SetID(VIEW_ID_LOCATION_BAR); |
| 126 SetFocusable(true); | 127 SetFocusable(true); |
| 127 | 128 |
| 128 if (mode_ == NORMAL) | 129 if (mode_ == NORMAL) |
| 129 painter_.reset(new views::HorizontalPainter(kNormalModeBackgroundImages)); | 130 painter_.reset(new views::HorizontalPainter(kNormalModeBackgroundImages)); |
| 130 | 131 |
| 131 edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled, | 132 edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled, |
| 132 profile_->GetPrefs(), this); | 133 profile_->GetPrefs(), this); |
| 133 } | 134 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 return color_utils::GetReadableColor(color, GetColor(security_level, | 263 return color_utils::GetReadableColor(color, GetColor(security_level, |
| 263 BACKGROUND)); | 264 BACKGROUND)); |
| 264 } | 265 } |
| 265 | 266 |
| 266 default: | 267 default: |
| 267 NOTREACHED(); | 268 NOTREACHED(); |
| 268 return GetColor(security_level, TEXT); | 269 return GetColor(security_level, TEXT); |
| 269 } | 270 } |
| 270 } | 271 } |
| 271 | 272 |
| 273 // DropdownBarHostDelegate |
| 274 void LocationBarView::SetFocusAndSelection(bool select_all) { |
| 275 FocusLocation(select_all); |
| 276 } |
| 277 |
| 278 void LocationBarView::SetAnimationOffset(int offset) { |
| 279 animation_offset_ = offset; |
| 280 } |
| 281 |
| 272 void LocationBarView::Update(const TabContents* tab_for_state_restoring) { | 282 void LocationBarView::Update(const TabContents* tab_for_state_restoring) { |
| 273 bool star_enabled = star_view_ && !model_->input_in_progress() && | 283 bool star_enabled = star_view_ && !model_->input_in_progress() && |
| 274 edit_bookmarks_enabled_.GetValue(); | 284 edit_bookmarks_enabled_.GetValue(); |
| 275 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); | 285 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); |
| 276 if (star_view_) | 286 if (star_view_) |
| 277 star_view_->SetVisible(star_enabled); | 287 star_view_->SetVisible(star_enabled); |
| 278 RefreshContentSettingViews(); | 288 RefreshContentSettingViews(); |
| 279 RefreshPageActionViews(); | 289 RefreshPageActionViews(); |
| 280 // Don't Update in app launcher mode so that the location entry does not show | 290 // Don't Update in app launcher mode so that the location entry does not show |
| 281 // a URL or security background. | 291 // a URL or security background. |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 Update(NULL); | 1211 Update(NULL); |
| 1202 } | 1212 } |
| 1203 } | 1213 } |
| 1204 | 1214 |
| 1205 #if defined(OS_WIN) | 1215 #if defined(OS_WIN) |
| 1206 bool LocationBarView::HasValidSuggestText() const { | 1216 bool LocationBarView::HasValidSuggestText() const { |
| 1207 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && | 1217 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && |
| 1208 !suggested_text_view_->GetText().empty(); | 1218 !suggested_text_view_->GetText().empty(); |
| 1209 } | 1219 } |
| 1210 #endif | 1220 #endif |
| OLD | NEW |