OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/about_network_dialog.h" | 5 #include "chrome/browser/views/about_network_dialog.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/thread.h" | 8 #include "base/thread.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/chrome_thread.h" |
10 #include "net/url_request/url_request.h" | 10 #include "net/url_request/url_request.h" |
11 #include "net/url_request/url_request_job.h" | 11 #include "net/url_request/url_request_job.h" |
12 #include "net/url_request/url_request_job_tracker.h" | 12 #include "net/url_request/url_request_job_tracker.h" |
13 #include "views/grid_layout.h" | 13 #include "views/grid_layout.h" |
14 #include "views/controls/button/text_button.h" | 14 #include "views/controls/button/text_button.h" |
15 #include "views/controls/textfield/textfield.h" | 15 #include "views/controls/textfield/textfield.h" |
16 #include "views/standard_layout.h" | 16 #include "views/standard_layout.h" |
17 #include "views/window/window.h" | 17 #include "views/window/window.h" |
18 | 18 |
19 namespace { | 19 namespace { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 JobTracker::JobTracker(AboutNetworkDialog* view) | 89 JobTracker::JobTracker(AboutNetworkDialog* view) |
90 : view_(view), | 90 : view_(view), |
91 view_message_loop_(MessageLoop::current()) { | 91 view_message_loop_(MessageLoop::current()) { |
92 } | 92 } |
93 | 93 |
94 JobTracker::~JobTracker() { | 94 JobTracker::~JobTracker() { |
95 } | 95 } |
96 | 96 |
97 // main thread: | 97 // main thread: |
98 void JobTracker::InvokeOnIOThread(void (JobTracker::*m)()) { | 98 void JobTracker::InvokeOnIOThread(void (JobTracker::*m)()) { |
99 base::Thread* thread = g_browser_process->io_thread(); | 99 ChromeThread::PostTask( |
100 if (!thread) | 100 ChromeThread::IO, FROM_HERE, NewRunnableMethod(this, m)); |
101 return; | |
102 thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(this, m)); | |
103 } | 101 } |
104 | 102 |
105 // main thread: | 103 // main thread: |
106 void JobTracker::StartTracking() { | 104 void JobTracker::StartTracking() { |
107 DCHECK(MessageLoop::current() == view_message_loop_); | 105 DCHECK(MessageLoop::current() == view_message_loop_); |
108 DCHECK(view_); | 106 DCHECK(view_); |
109 InvokeOnIOThread(&JobTracker::OnStartTracking); | 107 InvokeOnIOThread(&JobTracker::OnStartTracking); |
110 } | 108 } |
111 | 109 |
112 // main thread: | 110 // main thread: |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 tracking_ = true; | 366 tracking_ = true; |
369 tracker->StartTracking(); | 367 tracker->StartTracking(); |
370 } | 368 } |
371 track_toggle_->SchedulePaint(); | 369 track_toggle_->SchedulePaint(); |
372 } else if (button == show_button_) { | 370 } else if (button == show_button_) { |
373 tracker->ReportStatus(); | 371 tracker->ReportStatus(); |
374 } else if (button == clear_button_) { | 372 } else if (button == clear_button_) { |
375 text_field_->SetText(std::wstring()); | 373 text_field_->SetText(std::wstring()); |
376 } | 374 } |
377 } | 375 } |
OLD | NEW |