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

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

Issue 14494004: Added the 'Translation Logs' tab to chrome://translate-internals/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (Rebasing) 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
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "chrome/common/extensions/api/windows.h" 54 #include "chrome/common/extensions/api/windows.h"
55 #include "chrome/common/extensions/extension.h" 55 #include "chrome/common/extensions/extension.h"
56 #include "chrome/common/extensions/extension_constants.h" 56 #include "chrome/common/extensions/extension_constants.h"
57 #include "chrome/common/extensions/extension_file_util.h" 57 #include "chrome/common/extensions/extension_file_util.h"
58 #include "chrome/common/extensions/extension_l10n_util.h" 58 #include "chrome/common/extensions/extension_l10n_util.h"
59 #include "chrome/common/extensions/extension_manifest_constants.h" 59 #include "chrome/common/extensions/extension_manifest_constants.h"
60 #include "chrome/common/extensions/extension_messages.h" 60 #include "chrome/common/extensions/extension_messages.h"
61 #include "chrome/common/extensions/incognito_handler.h" 61 #include "chrome/common/extensions/incognito_handler.h"
62 #include "chrome/common/extensions/message_bundle.h" 62 #include "chrome/common/extensions/message_bundle.h"
63 #include "chrome/common/extensions/user_script.h" 63 #include "chrome/common/extensions/user_script.h"
64 #include "chrome/common/language_detection_details.h"
64 #include "chrome/common/pref_names.h" 65 #include "chrome/common/pref_names.h"
65 #include "chrome/common/url_constants.h" 66 #include "chrome/common/url_constants.h"
66 #include "components/user_prefs/pref_registry_syncable.h" 67 #include "components/user_prefs/pref_registry_syncable.h"
67 #include "content/public/browser/navigation_controller.h" 68 #include "content/public/browser/navigation_controller.h"
68 #include "content/public/browser/navigation_entry.h" 69 #include "content/public/browser/navigation_entry.h"
69 #include "content/public/browser/notification_details.h" 70 #include "content/public/browser/notification_details.h"
70 #include "content/public/browser/notification_source.h" 71 #include "content/public/browser/notification_source.h"
71 #include "content/public/browser/render_view_host.h" 72 #include "content/public/browser/render_view_host.h"
72 #include "content/public/browser/render_widget_host_view.h" 73 #include "content/public/browser/render_widget_host_view.h"
73 #include "content/public/browser/web_contents.h" 74 #include "content/public/browser/web_contents.h"
(...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after
1918 this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, 1919 this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
1919 content::Source<NavigationController>(&(contents->GetController()))); 1920 content::Source<NavigationController>(&(contents->GetController())));
1920 return true; 1921 return true;
1921 } 1922 }
1922 1923
1923 void TabsDetectLanguageFunction::Observe( 1924 void TabsDetectLanguageFunction::Observe(
1924 int type, 1925 int type,
1925 const content::NotificationSource& source, 1926 const content::NotificationSource& source,
1926 const content::NotificationDetails& details) { 1927 const content::NotificationDetails& details) {
1927 std::string language; 1928 std::string language;
1928 if (type == chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED) 1929 if (type == chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED) {
1929 language = *content::Details<std::string>(details).ptr(); 1930 const LanguageDetectionDetails* lang_det_details =
1931 content::Details<const LanguageDetectionDetails>(details).ptr();
1932 language = lang_det_details->adopted_language;
1933 }
1930 1934
1931 registrar_.RemoveAll(); 1935 registrar_.RemoveAll();
1932 1936
1933 // Call GotLanguage in all cases as we want to guarantee the callback is 1937 // Call GotLanguage in all cases as we want to guarantee the callback is
1934 // called for every API call the extension made. 1938 // called for every API call the extension made.
1935 GotLanguage(language); 1939 GotLanguage(language);
1936 } 1940 }
1937 1941
1938 void TabsDetectLanguageFunction::GotLanguage(const std::string& language) { 1942 void TabsDetectLanguageFunction::GotLanguage(const std::string& language) {
1939 SetResult(Value::CreateStringValue(language.c_str())); 1943 SetResult(Value::CreateStringValue(language.c_str()));
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
2171 extension->id(), 2175 extension->id(),
2172 script_type, 2176 script_type,
2173 code_string, 2177 code_string,
2174 frame_scope, 2178 frame_scope,
2175 run_at, 2179 run_at,
2176 ScriptExecutor::ISOLATED_WORLD, 2180 ScriptExecutor::ISOLATED_WORLD,
2177 false /* is_web_view */, 2181 false /* is_web_view */,
2178 base::Bind(&ExecuteCodeInTabFunction::OnExecuteCodeFinished, this)); 2182 base::Bind(&ExecuteCodeInTabFunction::OnExecuteCodeFinished, this));
2179 return true; 2183 return true;
2180 } 2184 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698