| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/location_bar/location_bar_view.h" | 5 #include "chrome/browser/views/location_bar/location_bar_view.h" |
| 6 | 6 |
| 7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
| 42 #include "chrome/browser/views/first_run_bubble.h" | 42 #include "chrome/browser/views/first_run_bubble.h" |
| 43 #endif | 43 #endif |
| 44 | 44 |
| 45 using views::View; | 45 using views::View; |
| 46 | 46 |
| 47 // static | 47 // static |
| 48 const int LocationBarView::kNormalHorizontalEdgeThickness = 1; | 48 const int LocationBarView::kNormalHorizontalEdgeThickness = 1; |
| 49 const int LocationBarView::kVerticalEdgeThickness = 2; | 49 const int LocationBarView::kVerticalEdgeThickness = 2; |
| 50 const int LocationBarView::kItemPadding = 3; | 50 const int LocationBarView::kItemPadding = 3; |
| 51 const int LocationBarView::kExtensionItemPadding = 5; |
| 51 const int LocationBarView::kEdgeItemPadding = kItemPadding; | 52 const int LocationBarView::kEdgeItemPadding = kItemPadding; |
| 52 const int LocationBarView::kBubblePadding = 1; | 53 const int LocationBarView::kBubblePadding = 1; |
| 53 const char LocationBarView::kViewClassName[] = | 54 const char LocationBarView::kViewClassName[] = |
| 54 "browser/views/location_bar/LocationBarView"; | 55 "browser/views/location_bar/LocationBarView"; |
| 55 | 56 |
| 56 static const int kEVBubbleBackgroundImages[] = { | 57 static const int kEVBubbleBackgroundImages[] = { |
| 57 IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_L, | 58 IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_L, |
| 58 IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_C, | 59 IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_C, |
| 59 IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_R, | 60 IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_R, |
| 60 }; | 61 }; |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 keyword_hint_view_->SetVisible(show_keyword_hint); | 484 keyword_hint_view_->SetVisible(show_keyword_hint); |
| 484 if (show_selected_keyword) { | 485 if (show_selected_keyword) { |
| 485 if (selected_keyword_view_->keyword() != keyword) { | 486 if (selected_keyword_view_->keyword() != keyword) { |
| 486 selected_keyword_view_->SetKeyword(keyword); | 487 selected_keyword_view_->SetKeyword(keyword); |
| 487 const TemplateURL* template_url = | 488 const TemplateURL* template_url = |
| 488 profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword); | 489 profile_->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword); |
| 489 if (template_url && template_url->IsExtensionKeyword()) { | 490 if (template_url && template_url->IsExtensionKeyword()) { |
| 490 const SkBitmap& bitmap = profile_->GetExtensionsService()-> | 491 const SkBitmap& bitmap = profile_->GetExtensionsService()-> |
| 491 GetOmniboxIcon(template_url->GetExtensionId()); | 492 GetOmniboxIcon(template_url->GetExtensionId()); |
| 492 selected_keyword_view_->SetImage(bitmap); | 493 selected_keyword_view_->SetImage(bitmap); |
| 494 selected_keyword_view_->SetItemPadding(kExtensionItemPadding); |
| 493 } else { | 495 } else { |
| 494 selected_keyword_view_->SetImage(*ResourceBundle::GetSharedInstance(). | 496 selected_keyword_view_->SetImage(*ResourceBundle::GetSharedInstance(). |
| 495 GetBitmapNamed(IDR_OMNIBOX_SEARCH)); | 497 GetBitmapNamed(IDR_OMNIBOX_SEARCH)); |
| 498 selected_keyword_view_->SetItemPadding(kItemPadding); |
| 496 } | 499 } |
| 497 } | 500 } |
| 498 } else if (show_keyword_hint) { | 501 } else if (show_keyword_hint) { |
| 499 if (keyword_hint_view_->keyword() != keyword) | 502 if (keyword_hint_view_->keyword() != keyword) |
| 500 keyword_hint_view_->SetKeyword(keyword); | 503 keyword_hint_view_->SetKeyword(keyword); |
| 501 } | 504 } |
| 502 | 505 |
| 503 // Lay out items to the right of the edit field. | 506 // Lay out items to the right of the edit field. |
| 504 int offset = width() - kEdgeThickness - kEdgeItemPadding; | 507 int offset = width() - kEdgeThickness - kEdgeItemPadding; |
| 505 if (star_view_ && star_view_->IsVisible()) { | 508 if (star_view_ && star_view_->IsVisible()) { |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 | 1071 |
| 1069 NOTREACHED(); | 1072 NOTREACHED(); |
| 1070 } | 1073 } |
| 1071 | 1074 |
| 1072 void LocationBarView::OnTemplateURLModelChanged() { | 1075 void LocationBarView::OnTemplateURLModelChanged() { |
| 1073 template_url_model_->RemoveObserver(this); | 1076 template_url_model_->RemoveObserver(this); |
| 1074 template_url_model_ = NULL; | 1077 template_url_model_ = NULL; |
| 1075 ShowFirstRunBubble(bubble_type_); | 1078 ShowFirstRunBubble(bubble_type_); |
| 1076 } | 1079 } |
| 1077 | 1080 |
| OLD | NEW |