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

Side by Side Diff: chrome/browser/ui/views/accessible_pane_view.cc

Issue 8301022: ui/views: Migrate usages of ScopedRunnableMethodFactory to base::WeakPtrFactory/base::Bind pair. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 months 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) 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/accessible_pane_view.h"
6
7 #include "base/bind.h"
5 #include "base/logging.h" 8 #include "base/logging.h"
6 #include "chrome/browser/ui/view_ids.h" 9 #include "chrome/browser/ui/view_ids.h"
7 #include "chrome/browser/ui/views/accessible_pane_view.h"
8 #include "chrome/browser/ui/views/frame/browser_view.h" 10 #include "chrome/browser/ui/views/frame/browser_view.h"
9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 11 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
10 #include "ui/base/accessibility/accessible_view_state.h" 12 #include "ui/base/accessibility/accessible_view_state.h"
11 #include "views/controls/button/menu_button.h" 13 #include "views/controls/button/menu_button.h"
12 #include "views/controls/native/native_view_host.h" 14 #include "views/controls/native/native_view_host.h"
13 #include "views/focus/focus_search.h" 15 #include "views/focus/focus_search.h"
14 #include "views/focus/view_storage.h" 16 #include "views/focus/view_storage.h"
15 #include "views/widget/tooltip_manager.h" 17 #include "views/widget/tooltip_manager.h"
16 #include "views/widget/widget.h" 18 #include "views/widget/widget.h"
17 19
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 return; 212 return;
211 213
212 views::FocusManager::FocusChangeReason reason = 214 views::FocusManager::FocusChangeReason reason =
213 focus_manager_->focus_change_reason(); 215 focus_manager_->focus_change_reason();
214 216
215 if (focused_now->GetClassName() == LocationBarView::kViewClassName && 217 if (focused_now->GetClassName() == LocationBarView::kViewClassName &&
216 reason == views::FocusManager::kReasonFocusTraversal) { 218 reason == views::FocusManager::kReasonFocusTraversal) {
217 // Tabbing to the location bar should select all. Defer so that it happens 219 // Tabbing to the location bar should select all. Defer so that it happens
218 // after the focus. 220 // after the focus.
219 MessageLoop::current()->PostTask( 221 MessageLoop::current()->PostTask(
220 FROM_HERE, method_factory_.NewRunnableMethod( 222 FROM_HERE,
221 &AccessiblePaneView::LocationBarSelectAll)); 223 base::Bind(&AccessiblePaneView::LocationBarSelectAll,
224 method_factory_.GetWeakPtr()));
222 } 225 }
223 226
224 if (!Contains(focused_now) || 227 if (!Contains(focused_now) ||
225 reason == views::FocusManager::kReasonDirectFocusChange) { 228 reason == views::FocusManager::kReasonDirectFocusChange) {
226 // We should remove pane focus (i.e. make most of the controls 229 // We should remove pane focus (i.e. make most of the controls
227 // not focusable again) either because the focus is leaving the pane, 230 // not focusable again) either because the focus is leaving the pane,
228 // or because the focus changed within the pane due to the user 231 // or because the focus changed within the pane due to the user
229 // directly focusing to a specific view (e.g., clicking on it). 232 // directly focusing to a specific view (e.g., clicking on it).
230 // 233 //
231 // Defer rather than calling RemovePaneFocus right away, because we can't 234 // Defer rather than calling RemovePaneFocus right away, because we can't
232 // remove |this| as a focus change listener while FocusManager is in the 235 // remove |this| as a focus change listener while FocusManager is in the
233 // middle of iterating over the list of listeners. 236 // middle of iterating over the list of listeners.
234 MessageLoop::current()->PostTask( 237 MessageLoop::current()->PostTask(
235 FROM_HERE, method_factory_.NewRunnableMethod( 238 FROM_HERE,
236 &AccessiblePaneView::RemovePaneFocus)); 239 base::Bind(&AccessiblePaneView::RemovePaneFocus,
240 method_factory_.GetWeakPtr()));
237 } 241 }
238 } 242 }
239 243
240 //////////////////////////////////////////////////////////////////////////////// 244 ////////////////////////////////////////////////////////////////////////////////
241 // FocusTraversable overrides: 245 // FocusTraversable overrides:
242 246
243 views::FocusSearch* AccessiblePaneView::GetFocusSearch() { 247 views::FocusSearch* AccessiblePaneView::GetFocusSearch() {
244 DCHECK(pane_has_focus_); 248 DCHECK(pane_has_focus_);
245 return focus_search_.get(); 249 return focus_search_.get();
246 } 250 }
247 251
248 views::FocusTraversable* AccessiblePaneView::GetFocusTraversableParent() { 252 views::FocusTraversable* AccessiblePaneView::GetFocusTraversableParent() {
249 DCHECK(pane_has_focus_); 253 DCHECK(pane_has_focus_);
250 return NULL; 254 return NULL;
251 } 255 }
252 256
253 views::View* AccessiblePaneView::GetFocusTraversableParentView() { 257 views::View* AccessiblePaneView::GetFocusTraversableParentView() {
254 DCHECK(pane_has_focus_); 258 DCHECK(pane_has_focus_);
255 return NULL; 259 return NULL;
256 } 260 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/accessible_pane_view.h ('k') | chrome/browser/ui/views/bookmarks/bookmark_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698