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

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

Issue 14307023: chrome: Use base::MessageLoop. (Part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // defined(OS_WIN) 10 #endif // defined(OS_WIN)
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 } 1143 }
1144 } 1144 }
1145 1145
1146 void Browser::TabStripEmpty() { 1146 void Browser::TabStripEmpty() {
1147 // Close the frame after we return to the message loop (not immediately, 1147 // Close the frame after we return to the message loop (not immediately,
1148 // otherwise it will destroy this object before the stack has a chance to 1148 // otherwise it will destroy this object before the stack has a chance to
1149 // cleanly unwind.) 1149 // cleanly unwind.)
1150 // Note: This will be called several times if TabStripEmpty is called several 1150 // Note: This will be called several times if TabStripEmpty is called several
1151 // times. This is because it does not close the window if tabs are 1151 // times. This is because it does not close the window if tabs are
1152 // still present. 1152 // still present.
1153 MessageLoop::current()->PostTask( 1153 base::MessageLoop::current()->PostTask(
1154 FROM_HERE, base::Bind(&Browser::CloseFrame, weak_factory_.GetWeakPtr())); 1154 FROM_HERE, base::Bind(&Browser::CloseFrame, weak_factory_.GetWeakPtr()));
1155 1155
1156 // Instant may have visible WebContents that need to be detached before the 1156 // Instant may have visible WebContents that need to be detached before the
1157 // window system closes. 1157 // window system closes.
1158 instant_controller_.reset(); 1158 instant_controller_.reset();
1159 } 1159 }
1160 1160
1161 bool Browser::CanOverscrollContent() const { 1161 bool Browser::CanOverscrollContent() const {
1162 #if defined(USE_AURA) 1162 #if defined(USE_AURA)
1163 bool overscroll_enabled = CommandLine::ForCurrentProcess()-> 1163 bool overscroll_enabled = CommandLine::ForCurrentProcess()->
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1891 1891
1892 // If the only updates were synchronously handled above, we're done. 1892 // If the only updates were synchronously handled above, we're done.
1893 if (changed_flags == 0) 1893 if (changed_flags == 0)
1894 return; 1894 return;
1895 1895
1896 // Save the dirty bits. 1896 // Save the dirty bits.
1897 scheduled_updates_[source] |= changed_flags; 1897 scheduled_updates_[source] |= changed_flags;
1898 1898
1899 if (!chrome_updater_factory_.HasWeakPtrs()) { 1899 if (!chrome_updater_factory_.HasWeakPtrs()) {
1900 // No task currently scheduled, start another. 1900 // No task currently scheduled, start another.
1901 MessageLoop::current()->PostDelayedTask( 1901 base::MessageLoop::current()->PostDelayedTask(
1902 FROM_HERE, 1902 FROM_HERE,
1903 base::Bind(&Browser::ProcessPendingUIUpdates, 1903 base::Bind(&Browser::ProcessPendingUIUpdates,
1904 chrome_updater_factory_.GetWeakPtr()), 1904 chrome_updater_factory_.GetWeakPtr()),
1905 base::TimeDelta::FromMilliseconds(kUIUpdateCoalescingTimeMS)); 1905 base::TimeDelta::FromMilliseconds(kUIUpdateCoalescingTimeMS));
1906 } 1906 }
1907 } 1907 }
1908 1908
1909 void Browser::ProcessPendingUIUpdates() { 1909 void Browser::ProcessPendingUIUpdates() {
1910 #ifndef NDEBUG 1910 #ifndef NDEBUG
1911 // Validate that all tabs we have pending updates for exist. This is scary 1911 // Validate that all tabs we have pending updates for exist. This is scary
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
2262 if (contents && !allow_js_access) { 2262 if (contents && !allow_js_access) {
2263 contents->web_contents()->GetController().LoadURL( 2263 contents->web_contents()->GetController().LoadURL(
2264 target_url, 2264 target_url,
2265 content::Referrer(), 2265 content::Referrer(),
2266 content::PAGE_TRANSITION_LINK, 2266 content::PAGE_TRANSITION_LINK,
2267 std::string()); // No extra headers. 2267 std::string()); // No extra headers.
2268 } 2268 }
2269 2269
2270 return contents != NULL; 2270 return contents != NULL;
2271 } 2271 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/bookmarks/bookmark_context_menu_controller_unittest.cc ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698