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

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

Issue 399068: Move base64 from 'net/base' into 'base'. (Closed)
Patch Set: rebase Created 11 years, 1 month 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) 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 "app/gfx/codec/jpeg_codec.h" 7 #include "app/gfx/codec/jpeg_codec.h"
8 #include "base/base64.h"
8 #include "base/string_util.h" 9 #include "base/string_util.h"
9 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
10 #include "chrome/browser/browser_list.h" 11 #include "chrome/browser/browser_list.h"
11 #include "chrome/browser/browser_window.h" 12 #include "chrome/browser/browser_window.h"
12 #include "chrome/browser/extensions/extension_function_dispatcher.h" 13 #include "chrome/browser/extensions/extension_function_dispatcher.h"
13 #include "chrome/browser/extensions/extension_tabs_module_constants.h" 14 #include "chrome/browser/extensions/extension_tabs_module_constants.h"
14 #include "chrome/browser/extensions/extensions_service.h" 15 #include "chrome/browser/extensions/extensions_service.h"
15 #include "chrome/browser/profile.h" 16 #include "chrome/browser/profile.h"
16 #include "chrome/browser/renderer_host/backing_store.h" 17 #include "chrome/browser/renderer_host/backing_store.h"
17 #include "chrome/browser/renderer_host/render_view_host.h" 18 #include "chrome/browser/renderer_host/render_view_host.h"
18 #include "chrome/browser/renderer_host/render_view_host_delegate.h" 19 #include "chrome/browser/renderer_host/render_view_host_delegate.h"
19 #include "chrome/browser/tab_contents/navigation_entry.h" 20 #include "chrome/browser/tab_contents/navigation_entry.h"
20 #include "chrome/browser/tab_contents/tab_contents.h" 21 #include "chrome/browser/tab_contents/tab_contents.h"
21 #include "chrome/browser/window_sizer.h" 22 #include "chrome/browser/window_sizer.h"
22 #include "chrome/common/extensions/extension.h" 23 #include "chrome/common/extensions/extension.h"
23 #include "chrome/common/extensions/extension_error_utils.h" 24 #include "chrome/common/extensions/extension_error_utils.h"
24 #include "chrome/common/url_constants.h" 25 #include "chrome/common/url_constants.h"
25 #include "net/base/base64.h"
26 #include "skia/ext/image_operations.h" 26 #include "skia/ext/image_operations.h"
27 #include "skia/ext/platform_canvas.h" 27 #include "skia/ext/platform_canvas.h"
28 #include "third_party/skia/include/core/SkBitmap.h" 28 #include "third_party/skia/include/core/SkBitmap.h"
29 29
30 namespace keys = extension_tabs_module_constants; 30 namespace keys = extension_tabs_module_constants;
31 31
32 // Forward declare static helper functions defined below. 32 // Forward declare static helper functions defined below.
33 33
34 // |error_message| can optionally be passed in a will be set with an appropriate 34 // |error_message| can optionally be passed in a will be set with an appropriate
35 // message if the window cannot be found by id. 35 // message if the window cannot be found by id.
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 return false; 797 return false;
798 } 798 }
799 799
800 std::string base64_result; 800 std::string base64_result;
801 std::string stream_as_string; 801 std::string stream_as_string;
802 stream_as_string.resize(jpeg_data->data.size()); 802 stream_as_string.resize(jpeg_data->data.size());
803 memcpy(&stream_as_string[0], 803 memcpy(&stream_as_string[0],
804 reinterpret_cast<const char*>(&jpeg_data->data[0]), 804 reinterpret_cast<const char*>(&jpeg_data->data[0]),
805 jpeg_data->data.size()); 805 jpeg_data->data.size());
806 806
807 net::Base64Encode(stream_as_string, &base64_result); 807 base::Base64Encode(stream_as_string, &base64_result);
808 base64_result.insert(0, "data:image/jpg;base64,"); 808 base64_result.insert(0, "data:image/jpg;base64,");
809 result_.reset(new StringValue(base64_result)); 809 result_.reset(new StringValue(base64_result));
810 return true; 810 return true;
811 } 811 }
812 812
813 bool DetectTabLanguageFunction::RunImpl() { 813 bool DetectTabLanguageFunction::RunImpl() {
814 #if !defined(OS_WIN) 814 #if !defined(OS_WIN)
815 error_ = keys::kSupportedInWindowsOnlyError; 815 error_ = keys::kSupportedInWindowsOnlyError;
816 return false; 816 return false;
817 #endif 817 #endif
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 if (ExtensionTabUtil::GetTabById(tab_id, profile, browser, tab_strip, 888 if (ExtensionTabUtil::GetTabById(tab_id, profile, browser, tab_strip,
889 contents, tab_index)) 889 contents, tab_index))
890 return true; 890 return true;
891 891
892 if (error_message) 892 if (error_message)
893 *error_message = ExtensionErrorUtils::FormatErrorMessage( 893 *error_message = ExtensionErrorUtils::FormatErrorMessage(
894 keys::kTabNotFoundError, IntToString(tab_id)); 894 keys::kTabNotFoundError, IntToString(tab_id));
895 895
896 return false; 896 return false;
897 } 897 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_creator.cc ('k') | chrome/browser/extensions/extensions_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698