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

Side by Side Diff: chrome/browser/extensions/extensions_ui.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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-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/extensions_ui.h" 5 #include "chrome/browser/extensions/extensions_ui.h"
6 6
7 #include "app/gfx/codec/png_codec.h" 7 #include "app/gfx/codec/png_codec.h"
8 #include "app/gfx/color_utils.h" 8 #include "app/gfx/color_utils.h"
9 #include "app/gfx/skbitmap_operations.h" 9 #include "app/gfx/skbitmap_operations.h"
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
11 #include "app/resource_bundle.h" 11 #include "app/resource_bundle.h"
12 #include "base/base64.h"
12 #include "base/file_util.h" 13 #include "base/file_util.h"
13 #include "base/string_util.h" 14 #include "base/string_util.h"
14 #include "base/thread.h" 15 #include "base/thread.h"
15 #include "chrome/browser/browser.h" 16 #include "chrome/browser/browser.h"
16 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/debugger/devtools_manager.h" 18 #include "chrome/browser/debugger/devtools_manager.h"
18 #include "chrome/browser/extensions/crx_installer.h" 19 #include "chrome/browser/extensions/crx_installer.h"
19 #include "chrome/browser/extensions/extension_function_dispatcher.h" 20 #include "chrome/browser/extensions/extension_function_dispatcher.h"
20 #include "chrome/browser/extensions/extension_message_service.h" 21 #include "chrome/browser/extensions/extension_message_service.h"
21 #include "chrome/browser/extensions/extensions_service.h" 22 #include "chrome/browser/extensions/extensions_service.h"
(...skipping 11 matching lines...) Expand all
33 #include "chrome/common/extensions/url_pattern.h" 34 #include "chrome/common/extensions/url_pattern.h"
34 #include "chrome/common/jstemplate_builder.h" 35 #include "chrome/common/jstemplate_builder.h"
35 #include "chrome/common/notification_service.h" 36 #include "chrome/common/notification_service.h"
36 #include "chrome/common/notification_type.h" 37 #include "chrome/common/notification_type.h"
37 #include "chrome/common/pref_names.h" 38 #include "chrome/common/pref_names.h"
38 #include "chrome/common/pref_service.h" 39 #include "chrome/common/pref_service.h"
39 #include "chrome/common/url_constants.h" 40 #include "chrome/common/url_constants.h"
40 #include "grit/browser_resources.h" 41 #include "grit/browser_resources.h"
41 #include "grit/generated_resources.h" 42 #include "grit/generated_resources.h"
42 #include "grit/theme_resources.h" 43 #include "grit/theme_resources.h"
43 #include "net/base/base64.h"
44 #include "net/base/net_util.h" 44 #include "net/base/net_util.h"
45 #include "webkit/glue/image_decoder.h" 45 #include "webkit/glue/image_decoder.h"
46 46
47 //////////////////////////////////////////////////////////////////////////////// 47 ////////////////////////////////////////////////////////////////////////////////
48 // 48 //
49 // ExtensionsHTMLSource 49 // ExtensionsHTMLSource
50 // 50 //
51 //////////////////////////////////////////////////////////////////////////////// 51 ////////////////////////////////////////////////////////////////////////////////
52 52
53 ExtensionsUIHTMLSource::ExtensionsUIHTMLSource() 53 ExtensionsUIHTMLSource::ExtensionsUIHTMLSource()
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 gfx::PNGCodec::EncodeBGRASkBitmap(*decoded, false, &output); 199 gfx::PNGCodec::EncodeBGRASkBitmap(*decoded, false, &output);
200 200
201 // Lame, but we must make a copy of this now, because base64 doesn't take 201 // Lame, but we must make a copy of this now, because base64 doesn't take
202 // the same input type. 202 // the same input type.
203 file_contents.assign(reinterpret_cast<char*>(&output.front()), 203 file_contents.assign(reinterpret_cast<char*>(&output.front()),
204 output.size()); 204 output.size());
205 } 205 }
206 206
207 // Create a data URL (all icons are converted to PNGs during unpacking). 207 // Create a data URL (all icons are converted to PNGs during unpacking).
208 std::string base64_encoded; 208 std::string base64_encoded;
209 net::Base64Encode(file_contents, &base64_encoded); 209 base::Base64Encode(file_contents, &base64_encoded);
210 GURL icon_url("data:image/png;base64," + base64_encoded); 210 GURL icon_url("data:image/png;base64," + base64_encoded);
211 211
212 extension->SetString(L"icon", icon_url.spec()); 212 extension->SetString(L"icon", icon_url.spec());
213 } 213 }
214 214
215 ChromeThread::PostTask( 215 ChromeThread::PostTask(
216 ChromeThread::UI, FROM_HERE, 216 ChromeThread::UI, FROM_HERE,
217 NewRunnableMethod(this, &IconLoader::ReportResultOnUIThread, 217 NewRunnableMethod(this, &IconLoader::ReportResultOnUIThread,
218 json_deleter.release())); 218 json_deleter.release()));
219 } 219 }
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 // static 746 // static
747 RefCountedMemory* ExtensionsUI::GetFaviconResourceBytes() { 747 RefCountedMemory* ExtensionsUI::GetFaviconResourceBytes() {
748 return ResourceBundle::GetSharedInstance(). 748 return ResourceBundle::GetSharedInstance().
749 LoadDataResourceBytes(IDR_PLUGIN); 749 LoadDataResourceBytes(IDR_PLUGIN);
750 } 750 }
751 751
752 // static 752 // static
753 void ExtensionsUI::RegisterUserPrefs(PrefService* prefs) { 753 void ExtensionsUI::RegisterUserPrefs(PrefService* prefs) {
754 prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode, false); 754 prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode, false);
755 } 755 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_tabs_module.cc ('k') | chrome/browser/extensions/sandboxed_extension_unpacker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698