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

Side by Side Diff: chrome/browser/extensions/api/tabs/tabs_api.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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) 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/extensions/api/tabs/tabs_api.h" 5 #include "chrome/browser/extensions/api/tabs/tabs_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1899 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 return false; 1910 return false;
1911 } 1911 }
1912 1912
1913 AddRef(); // Balanced in GotLanguage(). 1913 AddRef(); // Balanced in GotLanguage().
1914 1914
1915 TranslateTabHelper* translate_tab_helper = 1915 TranslateTabHelper* translate_tab_helper =
1916 TranslateTabHelper::FromWebContents(contents); 1916 TranslateTabHelper::FromWebContents(contents);
1917 if (!translate_tab_helper->language_state().original_language().empty()) { 1917 if (!translate_tab_helper->language_state().original_language().empty()) {
1918 // Delay the callback invocation until after the current JS call has 1918 // Delay the callback invocation until after the current JS call has
1919 // returned. 1919 // returned.
1920 MessageLoop::current()->PostTask(FROM_HERE, base::Bind( 1920 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
1921 &TabsDetectLanguageFunction::GotLanguage, this, 1921 &TabsDetectLanguageFunction::GotLanguage, this,
1922 translate_tab_helper->language_state().original_language())); 1922 translate_tab_helper->language_state().original_language()));
1923 return true; 1923 return true;
1924 } 1924 }
1925 // The tab contents does not know its language yet. Let's wait until it 1925 // The tab contents does not know its language yet. Let's wait until it
1926 // receives it, or until the tab is closed/navigates to some other page. 1926 // receives it, or until the tab is closed/navigates to some other page.
1927 registrar_.Add(this, chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, 1927 registrar_.Add(this, chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED,
1928 content::Source<WebContents>(contents)); 1928 content::Source<WebContents>(contents));
1929 registrar_.Add( 1929 registrar_.Add(
1930 this, chrome::NOTIFICATION_TAB_CLOSING, 1930 this, chrome::NOTIFICATION_TAB_CLOSING,
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 execute_tab_id_ = tab_id; 2068 execute_tab_id_ = tab_id;
2069 details_ = details.Pass(); 2069 details_ = details.Pass();
2070 return true; 2070 return true;
2071 } 2071 }
2072 2072
2073 bool TabsInsertCSSFunction::ShouldInsertCSS() const { 2073 bool TabsInsertCSSFunction::ShouldInsertCSS() const {
2074 return true; 2074 return true;
2075 } 2075 }
2076 2076
2077 } // namespace extensions 2077 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698