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