| 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 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 #include "ui/base/resource/resource_bundle.h" | 69 #include "ui/base/resource/resource_bundle.h" |
| 70 #include "ui/base/theme_provider.h" | 70 #include "ui/base/theme_provider.h" |
| 71 #include "ui/gfx/canvas.h" | 71 #include "ui/gfx/canvas.h" |
| 72 #include "ui/gfx/color_utils.h" | 72 #include "ui/gfx/color_utils.h" |
| 73 #include "ui/gfx/image/image.h" | 73 #include "ui/gfx/image/image.h" |
| 74 #include "ui/gfx/image/image_skia_operations.h" | 74 #include "ui/gfx/image/image_skia_operations.h" |
| 75 #include "ui/gfx/skia_util.h" | 75 #include "ui/gfx/skia_util.h" |
| 76 #include "ui/views/border.h" | 76 #include "ui/views/border.h" |
| 77 #include "ui/views/button_drag_utils.h" | 77 #include "ui/views/button_drag_utils.h" |
| 78 #include "ui/views/controls/label.h" | 78 #include "ui/views/controls/label.h" |
| 79 #include "ui/views/controls/textfield/textfield.h" |
| 79 #include "ui/views/layout/layout_constants.h" | 80 #include "ui/views/layout/layout_constants.h" |
| 80 #include "ui/views/widget/widget.h" | 81 #include "ui/views/widget/widget.h" |
| 81 | 82 |
| 82 #if defined(OS_WIN) | 83 #if defined(OS_WIN) |
| 83 #include "ui/native_theme/native_theme_win.h" | 84 #include "ui/native_theme/native_theme_win.h" |
| 84 #endif | 85 #endif |
| 85 | 86 |
| 86 #if defined(OS_WIN) && !defined(USE_AURA) | 87 #if defined(OS_WIN) && !defined(USE_AURA) |
| 87 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" | 88 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" |
| 88 #endif | 89 #endif |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 search_token_separator_view_(NULL), | 184 search_token_separator_view_(NULL), |
| 184 zoom_view_(NULL), | 185 zoom_view_(NULL), |
| 185 open_pdf_in_reader_view_(NULL), | 186 open_pdf_in_reader_view_(NULL), |
| 186 script_bubble_icon_view_(NULL), | 187 script_bubble_icon_view_(NULL), |
| 187 star_view_(NULL), | 188 star_view_(NULL), |
| 188 action_box_button_view_(NULL), | 189 action_box_button_view_(NULL), |
| 189 mode_(mode), | 190 mode_(mode), |
| 190 show_focus_rect_(false), | 191 show_focus_rect_(false), |
| 191 template_url_service_(NULL), | 192 template_url_service_(NULL), |
| 192 animation_offset_(0) { | 193 animation_offset_(0) { |
| 193 set_id(VIEW_ID_LOCATION_BAR); | 194 if (!views::Textfield::IsViewsTextfieldEnabled()) |
| 195 set_id(VIEW_ID_OMNIBOX); |
| 194 | 196 |
| 195 if (mode_ == NORMAL) { | 197 if (mode_ == NORMAL) { |
| 196 background_painter_.reset( | 198 background_painter_.reset( |
| 197 views::Painter::CreateImagePainter( | 199 views::Painter::CreateImagePainter( |
| 198 *ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 200 *ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 199 IDR_LOCATION_BAR_BORDER).ToImageSkia(), | 201 IDR_LOCATION_BAR_BORDER).ToImageSkia(), |
| 200 gfx::Insets(kBorderRoundCornerHeight, kBorderRoundCornerWidth, | 202 gfx::Insets(kBorderRoundCornerHeight, kBorderRoundCornerWidth, |
| 201 kBorderRoundCornerHeight, kBorderRoundCornerWidth))); | 203 kBorderRoundCornerHeight, kBorderRoundCornerWidth))); |
| 202 } | 204 } |
| 203 | 205 |
| (...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 int LocationBarView::GetInternalHeight(bool use_preferred_size) { | 1473 int LocationBarView::GetInternalHeight(bool use_preferred_size) { |
| 1472 int total_height = | 1474 int total_height = |
| 1473 use_preferred_size ? GetPreferredSize().height() : height(); | 1475 use_preferred_size ? GetPreferredSize().height() : height(); |
| 1474 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); | 1476 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); |
| 1475 } | 1477 } |
| 1476 | 1478 |
| 1477 bool LocationBarView::HasValidSuggestText() const { | 1479 bool LocationBarView::HasValidSuggestText() const { |
| 1478 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && | 1480 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && |
| 1479 !suggested_text_view_->text().empty(); | 1481 !suggested_text_view_->text().empty(); |
| 1480 } | 1482 } |
| OLD | NEW |