| 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 |
| 11 #include <algorithm> |
| 12 #include <map> |
| 13 |
| 11 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 12 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 13 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/app/chrome_command_ids.h" | 17 #include "chrome/app/chrome_command_ids.h" |
| 15 #include "chrome/browser/alternate_nav_url_fetcher.h" | 18 #include "chrome/browser/alternate_nav_url_fetcher.h" |
| 16 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 19 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 17 #include "chrome/browser/defaults.h" | 20 #include "chrome/browser/defaults.h" |
| 18 #include "chrome/browser/extensions/extension_browser_event_router.h" | 21 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 19 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
| 20 #include "chrome/browser/favicon/favicon_tab_helper.h" | 23 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 GetColor(ToolbarModel::NONE, | 436 GetColor(ToolbarModel::NONE, |
| 434 LocationBarView::DEEMPHASIZED_TEXT)); | 437 LocationBarView::DEEMPHASIZED_TEXT)); |
| 435 suggested_text_view_->SetText(UTF16ToWide(text)); | 438 suggested_text_view_->SetText(UTF16ToWide(text)); |
| 436 if (views::Widget::IsPureViews()) | 439 if (views::Widget::IsPureViews()) |
| 437 NOTIMPLEMENTED(); | 440 NOTIMPLEMENTED(); |
| 438 #if !defined(USE_AURA) | 441 #if !defined(USE_AURA) |
| 439 else | 442 else |
| 440 suggested_text_view_->SetFont(GetOmniboxViewWin()->GetFont()); | 443 suggested_text_view_->SetFont(GetOmniboxViewWin()->GetFont()); |
| 441 #endif | 444 #endif |
| 442 AddChildView(suggested_text_view_); | 445 AddChildView(suggested_text_view_); |
| 443 } else if (suggested_text_view_->GetText() != UTF16ToWide(text)) { | 446 } else if (suggested_text_view_->GetText() != text) { |
| 444 suggested_text_view_->SetText(UTF16ToWide(text)); | 447 suggested_text_view_->SetText(UTF16ToWide(text)); |
| 445 } | 448 } |
| 446 if (animate_to_complete && !location_entry_->IsImeComposing()) | 449 if (animate_to_complete && !location_entry_->IsImeComposing()) |
| 447 suggested_text_view_->StartAnimation(); | 450 suggested_text_view_->StartAnimation(); |
| 448 } else if (suggested_text_view_) { | 451 } else if (suggested_text_view_) { |
| 449 delete suggested_text_view_; | 452 delete suggested_text_view_; |
| 450 suggested_text_view_ = NULL; | 453 suggested_text_view_ = NULL; |
| 451 } else { | 454 } else { |
| 452 return; | 455 return; |
| 453 } | 456 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 location_icon_view_->SetVisible(false); | 506 location_icon_view_->SetVisible(false); |
| 504 ev_bubble_view_->SetVisible(false); | 507 ev_bubble_view_->SetVisible(false); |
| 505 const string16 keyword(location_entry_->model()->keyword()); | 508 const string16 keyword(location_entry_->model()->keyword()); |
| 506 const bool is_keyword_hint(location_entry_->model()->is_keyword_hint()); | 509 const bool is_keyword_hint(location_entry_->model()->is_keyword_hint()); |
| 507 const bool show_selected_keyword = !keyword.empty() && !is_keyword_hint; | 510 const bool show_selected_keyword = !keyword.empty() && !is_keyword_hint; |
| 508 if (show_selected_keyword) { | 511 if (show_selected_keyword) { |
| 509 // Assume the keyword might be hidden. | 512 // Assume the keyword might be hidden. |
| 510 entry_width -= (kEdgeThickness + kEdgeEditPadding); | 513 entry_width -= (kEdgeThickness + kEdgeEditPadding); |
| 511 } else if (model_->GetSecurityLevel() == ToolbarModel::EV_SECURE) { | 514 } else if (model_->GetSecurityLevel() == ToolbarModel::EV_SECURE) { |
| 512 ev_bubble_view_->SetVisible(true); | 515 ev_bubble_view_->SetVisible(true); |
| 513 ev_bubble_view_->SetLabel(UTF16ToWideHack(model_->GetEVCertName())); | 516 ev_bubble_view_->SetLabel(model_->GetEVCertName()); |
| 514 ev_bubble_width = ev_bubble_view_->GetPreferredSize().width(); | 517 ev_bubble_width = ev_bubble_view_->GetPreferredSize().width(); |
| 515 // We'll adjust this width and take it out of |entry_width| below. | 518 // We'll adjust this width and take it out of |entry_width| below. |
| 516 } else { | 519 } else { |
| 517 location_icon_view_->SetVisible(true); | 520 location_icon_view_->SetVisible(true); |
| 518 location_icon_width = location_icon_view_->GetPreferredSize().width(); | 521 location_icon_width = location_icon_view_->GetPreferredSize().width(); |
| 519 entry_width -= (kEdgeThickness + kEdgeItemPadding + location_icon_width + | 522 entry_width -= (kEdgeThickness + kEdgeItemPadding + location_icon_width + |
| 520 kItemEditPadding); | 523 kItemEditPadding); |
| 521 } | 524 } |
| 522 | 525 |
| 523 if (star_view_ && star_view_->IsVisible()) | 526 if (star_view_ && star_view_->IsVisible()) |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 !suggested_text_view_->GetText().empty(); | 1273 !suggested_text_view_->GetText().empty(); |
| 1271 } | 1274 } |
| 1272 | 1275 |
| 1273 #if !defined(USE_AURA) | 1276 #if !defined(USE_AURA) |
| 1274 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { | 1277 OmniboxViewWin* LocationBarView::GetOmniboxViewWin() { |
| 1275 CHECK(!views::Widget::IsPureViews()); | 1278 CHECK(!views::Widget::IsPureViews()); |
| 1276 return static_cast<OmniboxViewWin*>(location_entry_.get()); | 1279 return static_cast<OmniboxViewWin*>(location_entry_.get()); |
| 1277 } | 1280 } |
| 1278 #endif | 1281 #endif |
| 1279 #endif | 1282 #endif |
| OLD | NEW |