Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 108063004: Give up focus if the focused view becomes unfocusable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Extracted to common code into FocusManager class Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 ev_bubble_view_ = new EVBubbleView( 262 ev_bubble_view_ = new EVBubbleView(
263 bubble_font_list, GetColor(ToolbarModel::EV_SECURE, SECURITY_TEXT), 263 bubble_font_list, GetColor(ToolbarModel::EV_SECURE, SECURITY_TEXT),
264 background_color, this); 264 background_color, this);
265 ev_bubble_view_->set_drag_controller(this); 265 ev_bubble_view_->set_drag_controller(this);
266 AddChildView(ev_bubble_view_); 266 AddChildView(ev_bubble_view_);
267 267
268 // Initialize the Omnibox view. 268 // Initialize the Omnibox view.
269 omnibox_view_ = new OmniboxViewViews(this, profile_, command_updater(), 269 omnibox_view_ = new OmniboxViewViews(this, profile_, command_updater(),
270 is_popup_mode_, this, font_list); 270 is_popup_mode_, this, font_list);
271 omnibox_view_->Init(); 271 omnibox_view_->Init();
272 omnibox_view_->set_focusable(true); 272 omnibox_view_->SetFocusable(true);
273 AddChildView(omnibox_view_); 273 AddChildView(omnibox_view_);
274 274
275 // Initialize the inline autocomplete view which is visible only when IME is 275 // Initialize the inline autocomplete view which is visible only when IME is
276 // turned on. Use the same font with the omnibox and highlighted background. 276 // turned on. Use the same font with the omnibox and highlighted background.
277 ime_inline_autocomplete_view_ = new views::Label(string16(), font_list); 277 ime_inline_autocomplete_view_ = new views::Label(string16(), font_list);
278 ime_inline_autocomplete_view_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 278 ime_inline_autocomplete_view_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
279 ime_inline_autocomplete_view_->SetAutoColorReadabilityEnabled(false); 279 ime_inline_autocomplete_view_->SetAutoColorReadabilityEnabled(false);
280 ime_inline_autocomplete_view_->set_background( 280 ime_inline_autocomplete_view_->set_background(
281 views::Background::CreateSolidBackground(GetNativeTheme()->GetSystemColor( 281 views::Background::CreateSolidBackground(GetNativeTheme()->GetSystemColor(
282 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused))); 282 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused)));
(...skipping 17 matching lines...) Expand all
300 AddChildView(suggested_text_view_); 300 AddChildView(suggested_text_view_);
301 301
302 keyword_hint_view_ = new KeywordHintView( 302 keyword_hint_view_ = new KeywordHintView(
303 profile_, font_list, 303 profile_, font_list,
304 GetColor(ToolbarModel::NONE, LocationBarView::DEEMPHASIZED_TEXT), 304 GetColor(ToolbarModel::NONE, LocationBarView::DEEMPHASIZED_TEXT),
305 background_color); 305 background_color);
306 AddChildView(keyword_hint_view_); 306 AddChildView(keyword_hint_view_);
307 307
308 mic_search_view_ = new views::ImageButton(this); 308 mic_search_view_ = new views::ImageButton(this);
309 mic_search_view_->set_id(VIEW_ID_MIC_SEARCH_BUTTON); 309 mic_search_view_->set_id(VIEW_ID_MIC_SEARCH_BUTTON);
310 mic_search_view_->set_accessibility_focusable(true); 310 mic_search_view_->SetAccessibilityFocusable(true);
311 mic_search_view_->SetTooltipText( 311 mic_search_view_->SetTooltipText(
312 l10n_util::GetStringUTF16(IDS_TOOLTIP_MIC_SEARCH)); 312 l10n_util::GetStringUTF16(IDS_TOOLTIP_MIC_SEARCH));
313 mic_search_view_->SetImage( 313 mic_search_view_->SetImage(
314 views::Button::STATE_NORMAL, 314 views::Button::STATE_NORMAL,
315 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 315 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
316 IDR_OMNIBOX_MIC_SEARCH)); 316 IDR_OMNIBOX_MIC_SEARCH));
317 mic_search_view_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, 317 mic_search_view_->SetImageAlignment(views::ImageButton::ALIGN_CENTER,
318 views::ImageButton::ALIGN_MIDDLE); 318 views::ImageButton::ALIGN_MIDDLE);
319 mic_search_view_->SetVisible(false); 319 mic_search_view_->SetVisible(false);
320 InitTouchableLocationBarChildView(mic_search_view_); 320 InitTouchableLocationBarChildView(mic_search_view_);
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 bounds.Inset(-(horizontal_padding + 1) / 2, 0); 1465 bounds.Inset(-(horizontal_padding + 1) / 2, 0);
1466 location_bar_util::PaintExtensionActionBackground( 1466 location_bar_util::PaintExtensionActionBackground(
1467 *(*page_action_view)->image_view()->page_action(), 1467 *(*page_action_view)->image_view()->page_action(),
1468 tab_id, canvas, bounds, text_color, background_color); 1468 tab_id, canvas, bounds, text_color, background_color);
1469 } 1469 }
1470 } 1470 }
1471 1471
1472 void LocationBarView::AccessibilitySetValue(const string16& new_value) { 1472 void LocationBarView::AccessibilitySetValue(const string16& new_value) {
1473 omnibox_view_->SetUserText(new_value, new_value, true); 1473 omnibox_view_->SetUserText(new_value, new_value, true);
1474 } 1474 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698