| Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
 | 
| diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
 | 
| index c923a07aa062ead570208f23c5ab2fa9f84aeb8a..f06b7dc21196679df2c45e142df7bda34d898b40 100644
 | 
| --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
 | 
| +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
 | 
| @@ -1,4 +1,4 @@
 | 
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved.
 | 
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
 | 
|  // Use of this source code is governed by a BSD-style license that can be
 | 
|  // found in the LICENSE file.
 | 
|  
 | 
| @@ -40,11 +40,13 @@
 | 
|  #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h"
 | 
|  #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h"
 | 
|  #include "chrome/browser/ui/views/location_bar/location_bar_layout.h"
 | 
| +#include "chrome/browser/ui/views/location_bar/location_bar_separator_view.h"
 | 
|  #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
 | 
|  #include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h"
 | 
|  #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
 | 
|  #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h"
 | 
|  #include "chrome/browser/ui/views/location_bar/script_bubble_icon_view.h"
 | 
| +#include "chrome/browser/ui/views/location_bar/search_token_view.h"
 | 
|  #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h"
 | 
|  #include "chrome/browser/ui/views/location_bar/star_view.h"
 | 
|  #include "chrome/browser/ui/views/location_bar/web_intents_button_view.h"
 | 
| @@ -76,6 +78,7 @@
 | 
|  #include "ui/views/border.h"
 | 
|  #include "ui/views/button_drag_utils.h"
 | 
|  #include "ui/views/controls/label.h"
 | 
| +#include "ui/views/layout/layout_constants.h"
 | 
|  #include "ui/views/widget/widget.h"
 | 
|  
 | 
|  #if defined(OS_WIN)
 | 
| @@ -178,6 +181,8 @@ LocationBarView::LocationBarView(Browser* browser,
 | 
|        selected_keyword_view_(NULL),
 | 
|        suggested_text_view_(NULL),
 | 
|        keyword_hint_view_(NULL),
 | 
| +      search_token_view_(NULL),
 | 
| +      search_token_separator_view_(NULL),
 | 
|        zoom_view_(NULL),
 | 
|        open_pdf_in_reader_view_(NULL),
 | 
|        script_bubble_icon_view_(NULL),
 | 
| @@ -231,17 +236,17 @@ void LocationBarView::Init() {
 | 
|      font_ = font_.DeriveFont(-1);
 | 
|  
 | 
|    location_icon_view_ = new LocationIconView(this);
 | 
| -  AddChildView(location_icon_view_);
 | 
|    location_icon_view_->SetVisible(true);
 | 
|    location_icon_view_->set_drag_controller(this);
 | 
| +  AddChildView(location_icon_view_);
 | 
|  
 | 
|    ev_bubble_view_ =
 | 
|        new EVBubbleView(kEVBubbleBackgroundImages, IDR_OMNIBOX_HTTPS_VALID,
 | 
|                         GetColor(ToolbarModel::EV_SECURE, SECURITY_TEXT),
 | 
|                         this);
 | 
| -  AddChildView(ev_bubble_view_);
 | 
|    ev_bubble_view_->SetVisible(false);
 | 
|    ev_bubble_view_->set_drag_controller(this);
 | 
| +  AddChildView(ev_bubble_view_);
 | 
|  
 | 
|    // URL edit field.
 | 
|    // View container for URL edit field.
 | 
| @@ -256,14 +261,22 @@ void LocationBarView::Init() {
 | 
|        kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER,
 | 
|        GetColor(ToolbarModel::NONE, TEXT),
 | 
|        profile_);
 | 
| -  AddChildView(selected_keyword_view_);
 | 
| -  selected_keyword_view_->SetFont(font_);
 | 
|    selected_keyword_view_->SetVisible(false);
 | 
| +  selected_keyword_view_->SetFont(font_);
 | 
| +  AddChildView(selected_keyword_view_);
 | 
|  
 | 
|    keyword_hint_view_ = new KeywordHintView(profile_, this);
 | 
| -  AddChildView(keyword_hint_view_);
 | 
|    keyword_hint_view_->SetVisible(false);
 | 
|    keyword_hint_view_->SetFont(font_);
 | 
| +  AddChildView(keyword_hint_view_);
 | 
| +
 | 
| +  search_token_view_ = new SearchTokenView();
 | 
| +  search_token_view_->SetVisible(false);
 | 
| +  search_token_view_->SetFont(font_);
 | 
| +  AddChildView(search_token_view_);
 | 
| +  search_token_separator_view_ = new LocationBarSeparatorView();
 | 
| +  search_token_separator_view_->SetVisible(false);
 | 
| +  AddChildView(search_token_separator_view_);
 | 
|  
 | 
|    for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
 | 
|      ContentSettingImageView* content_blocked_view =
 | 
| @@ -272,8 +285,8 @@ void LocationBarView::Init() {
 | 
|                                      font_,
 | 
|                                      GetColor(ToolbarModel::NONE, TEXT));
 | 
|      content_setting_views_.push_back(content_blocked_view);
 | 
| -    AddChildView(content_blocked_view);
 | 
|      content_blocked_view->SetVisible(false);
 | 
| +    AddChildView(content_blocked_view);
 | 
|    }
 | 
|  
 | 
|    zoom_view_ = new ZoomView(model_, delegate_);
 | 
| @@ -289,24 +302,24 @@ void LocationBarView::Init() {
 | 
|    AddChildView(open_pdf_in_reader_view_);
 | 
|  
 | 
|    script_bubble_icon_view_ = new ScriptBubbleIconView(delegate());
 | 
| -  AddChildView(script_bubble_icon_view_);
 | 
|    script_bubble_icon_view_->SetVisible(false);
 | 
| +  AddChildView(script_bubble_icon_view_);
 | 
|  
 | 
|    if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) {
 | 
|      // Note: condition above means that the star icon is hidden in popups and in
 | 
|      // the app launcher.
 | 
|      star_view_ = new StarView(command_updater_);
 | 
| -    AddChildView(star_view_);
 | 
|      star_view_->SetVisible(true);
 | 
| +    AddChildView(star_view_);
 | 
|    }
 | 
|    if (extensions::FeatureSwitch::action_box()->IsEnabled() &&
 | 
|        mode_ == NORMAL && browser_) {
 | 
| +    if (star_view_)
 | 
| +      star_view_->SetVisible(false);
 | 
| +
 | 
|      action_box_button_view_ = new ActionBoxButtonView(browser_,
 | 
|          gfx::Point(kNormalHorizontalEdgeThickness, kVerticalEdgeThickness));
 | 
|      AddChildView(action_box_button_view_);
 | 
| -
 | 
| -    if (star_view_)
 | 
| -      star_view_->SetVisible(false);
 | 
|    }
 | 
|  
 | 
|    registrar_.Add(this,
 | 
| @@ -425,6 +438,25 @@ void LocationBarView::Update(const WebContents* tab_for_state_restoring) {
 | 
|    if (star_view_ && !extensions::FeatureSwitch::action_box()->IsEnabled())
 | 
|      star_view_->SetVisible(star_enabled);
 | 
|  
 | 
| +  string16 search_provider;
 | 
| +  if (!model_->GetInputInProgress() &&
 | 
| +      model_->WouldReplaceSearchURLWithSearchTerms()) {
 | 
| +    const TemplateURL* template_url =
 | 
| +        TemplateURLServiceFactory::GetForProfile(profile_)->
 | 
| +            GetDefaultSearchProvider();
 | 
| +    if (template_url) {
 | 
| +      search_provider = template_url->short_name();
 | 
| +      search_token_view_->SetBackgroundColor(GetColor(
 | 
| +          model_->GetSecurityLevel(), LocationBarView::BACKGROUND));
 | 
| +      SkColor text_color = GetColor(
 | 
| +          model_->GetSecurityLevel(), LocationBarView::DEEMPHASIZED_TEXT);
 | 
| +      search_token_view_->SetForegroundColor(text_color);
 | 
| +      search_token_separator_view_->set_separator_color(
 | 
| +          SkColorSetA(text_color, 64));  // 25% alpha.
 | 
| +    }
 | 
| +  }
 | 
| +  search_token_view_->SetSearchProvider(search_provider);
 | 
| +
 | 
|    // Don't Update in app launcher mode so that the location entry does not show
 | 
|    // a URL or security background.
 | 
|    if (mode_ != APP_LAUNCHER)
 | 
| @@ -673,11 +705,16 @@ void LocationBarView::Layout() {
 | 
|    location_icon_view_->SetVisible(false);
 | 
|    ev_bubble_view_->SetVisible(false);
 | 
|    keyword_hint_view_->SetVisible(false);
 | 
| +  search_token_view_->SetVisible(false);
 | 
| +  search_token_separator_view_->SetVisible(false);
 | 
|  
 | 
|    const string16 keyword(location_entry_->model()->keyword());
 | 
|    const bool is_keyword_hint(location_entry_->model()->is_keyword_hint());
 | 
| -  const bool show_selected_keyword = !keyword.empty() && !is_keyword_hint;
 | 
| -  const bool show_keyword_hint = !keyword.empty() && is_keyword_hint;
 | 
| +  const bool show_search_token = search_token_view_->has_search_provider();
 | 
| +  const bool show_selected_keyword = !keyword.empty() && !is_keyword_hint &&
 | 
| +      !show_search_token;
 | 
| +  const bool show_keyword_hint = !keyword.empty() && is_keyword_hint &&
 | 
| +      !show_search_token;
 | 
|    if (show_selected_keyword) {
 | 
|      left_decorations.AddDecoration(
 | 
|          kBubbleLocationY, 0, true, 0, kBubbleHorizontalPadding,
 | 
| @@ -763,6 +800,17 @@ void LocationBarView::Layout() {
 | 
|      if (keyword_hint_view_->keyword() != keyword)
 | 
|        keyword_hint_view_->SetKeyword(keyword);
 | 
|    }
 | 
| +  if (show_search_token) {
 | 
| +    // This must be the last item in the right decorations list, otherwise
 | 
| +    // right_decorations.set_item_padding() makes no sense.
 | 
| +    right_decorations.AddDecorationWithSeparator(
 | 
| +        kVerticalEdgeThickness, location_height, true, 0, GetEdgeItemPadding(),
 | 
| +        GetItemPadding(), 0, LocationBarLayout::SEPARATOR_BEFORE,
 | 
| +        GetItemPadding() * 2, 0, search_token_view_,
 | 
| +        search_token_separator_view_);
 | 
| +    right_decorations.set_item_edit_padding(
 | 
| +        views::kUnrelatedControlLargeHorizontalSpacing);
 | 
| +  }
 | 
|  
 | 
|    // Perform layout.
 | 
|    int full_width = width() - 2 * kEdgeThickness;
 | 
| 
 |