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

Side by Side Diff: chrome/browser/extensions/extension_tabs_module.cc

Issue 199064: [chromium-reviews] Language detection works only for Windows now. Make chrome.tabs.detectLanguag... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_tabs_module_constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/extensions/extension_tabs_module.h" 5 #include "chrome/browser/extensions/extension_tabs_module.h"
6 6
7 #include "base/gfx/jpeg_codec.h" 7 #include "base/gfx/jpeg_codec.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/browser.h" 9 #include "chrome/browser/browser.h"
10 #include "chrome/browser/browser_list.h" 10 #include "chrome/browser/browser_list.h"
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 reinterpret_cast<const char*>(&jpeg_data->data[0]), 757 reinterpret_cast<const char*>(&jpeg_data->data[0]),
758 jpeg_data->data.size()); 758 jpeg_data->data.size());
759 759
760 net::Base64Encode(stream_as_string, &base64_result); 760 net::Base64Encode(stream_as_string, &base64_result);
761 base64_result.insert(0, "data:image/jpg;base64,"); 761 base64_result.insert(0, "data:image/jpg;base64,");
762 result_.reset(new StringValue(base64_result)); 762 result_.reset(new StringValue(base64_result));
763 return true; 763 return true;
764 } 764 }
765 765
766 bool DetectTabLanguageFunction::RunImpl() { 766 bool DetectTabLanguageFunction::RunImpl() {
767 #if !defined(OS_WIN)
768 error_ = keys::kSupportedInWindowsOnlyError;
769 return false;
770 #endif
771
767 int tab_id = 0; 772 int tab_id = 0;
768 Browser* browser = NULL; 773 Browser* browser = NULL;
769 TabContents* contents = NULL; 774 TabContents* contents = NULL;
770 775
771 // If |tab_id| is specified, look for it. Otherwise default to selected tab 776 // If |tab_id| is specified, look for it. Otherwise default to selected tab
772 // in the current window. 777 // in the current window.
773 if (!args_->IsType(Value::TYPE_NULL)) { 778 if (!args_->IsType(Value::TYPE_NULL)) {
774 EXTENSION_FUNCTION_VALIDATE(args_->GetAsInteger(&tab_id)); 779 EXTENSION_FUNCTION_VALIDATE(args_->GetAsInteger(&tab_id));
775 if (!GetTabById(tab_id, profile(), &browser, NULL, &contents, NULL, 780 if (!GetTabById(tab_id, profile(), &browser, NULL, &contents, NULL,
776 &error_)) { 781 &error_)) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 if (ExtensionTabUtil::GetTabById(tab_id, profile, browser, tab_strip, 848 if (ExtensionTabUtil::GetTabById(tab_id, profile, browser, tab_strip,
844 contents, tab_index)) 849 contents, tab_index))
845 return true; 850 return true;
846 851
847 if (error_message) 852 if (error_message)
848 *error_message = ExtensionErrorUtils::FormatErrorMessage( 853 *error_message = ExtensionErrorUtils::FormatErrorMessage(
849 keys::kTabNotFoundError, IntToString(tab_id)); 854 keys::kTabNotFoundError, IntToString(tab_id));
850 855
851 return false; 856 return false;
852 } 857 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_tabs_module_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698