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

Unified Diff: chrome/browser/chromeos/status/status_area_view.cc

Issue 8332016: Use Closure instead of ScopedRunnableFactory in StatusAreaView. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review feedback 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/status/status_area_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/status/status_area_view.cc
===================================================================
--- chrome/browser/chromeos/status/status_area_view.cc (revision 106989)
+++ chrome/browser/chromeos/status/status_area_view.cc (working copy)
@@ -41,8 +41,7 @@
memory_view_(NULL),
network_view_(NULL),
power_view_(NULL),
- need_return_focus_(false),
- ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) {
+ need_return_focus_(false) {
}
StatusAreaView::~StatusAreaView() {
@@ -140,7 +139,7 @@
void StatusAreaView::TakeFocus(
bool reverse,
- const base::Callback<void(bool)>& return_focus_cb) {
+ const ReturnFocusCallback& return_focus_cb) {
// Emulates focus receive by AccessiblePaneView::SetPaneFocus.
if (!focus_manager_)
focus_manager_ = GetFocusManager();
@@ -172,16 +171,12 @@
if (need_return_focus_) {
const views::View* first = GetFirstFocusableChild();
const views::View* last = GetLastFocusableChild();
+ const bool first_to_last = (focused_before == first && focused_now == last);
+ const bool last_to_first = (focused_now == first && focused_before == last);
- if (focused_before == first && focused_now == last) {
- MessageLoop::current()->PostTask(
- FROM_HERE,
- task_factory_.NewRunnableMethod(&StatusAreaView::ReturnFocus, true));
- } else if (focused_now == first && focused_before == last) {
- MessageLoop::current()->PostTask(
- FROM_HERE,
- task_factory_.NewRunnableMethod(&StatusAreaView::ReturnFocus, false));
- }
+ if (first_to_last || last_to_first)
+ MessageLoop::current()->PostTask(FROM_HERE,
+ base::Bind(&StatusAreaView::ReturnFocus, AsWeakPtr(), first_to_last));
}
}
« no previous file with comments | « chrome/browser/chromeos/status/status_area_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698