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

Side by Side Diff: chrome/browser/gears_integration.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/gears_integration.h" 5 #include "chrome/browser/gears_integration.h"
6 6
7 #include "app/gfx/codec/png_codec.h" 7 #include "app/gfx/codec/png_codec.h"
8 #include "base/base64.h"
8 #include "base/logging.h" 9 #include "base/logging.h"
9 #include "base/message_loop.h" 10 #include "base/message_loop.h"
10 #include "base/string_util.h" 11 #include "base/string_util.h"
11 #include "chrome/browser/chrome_plugin_host.h" 12 #include "chrome/browser/chrome_plugin_host.h"
12 #include "chrome/common/chrome_plugin_util.h" 13 #include "chrome/common/chrome_plugin_util.h"
13 #include "chrome/common/gears_api.h" 14 #include "chrome/common/gears_api.h"
14 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
15 #include "net/base/base64.h"
16 #include "third_party/skia/include/core/SkBitmap.h" 16 #include "third_party/skia/include/core/SkBitmap.h"
17 #include "webkit/glue/dom_operations.h" 17 #include "webkit/glue/dom_operations.h"
18 18
19 // The following 2 helpers are borrowed from the Gears codebase. 19 // The following 2 helpers are borrowed from the Gears codebase.
20 20
21 const size_t kUserPathComponentMaxChars = 64; 21 const size_t kUserPathComponentMaxChars = 64;
22 22
23 // Returns true if and only if the char meets the following criteria: 23 // Returns true if and only if the char meets the following criteria:
24 // 24 //
25 // - visible ASCII 25 // - visible ASCII
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 DCHECK(icon.width() == 16 && icon.height() == 16); 115 DCHECK(icon.width() == 16 && icon.height() == 16);
116 116
117 // Get the FavIcon data. 117 // Get the FavIcon data.
118 std::vector<unsigned char> icon_data; 118 std::vector<unsigned char> icon_data;
119 gfx::PNGCodec::EncodeBGRASkBitmap(icon, false, &icon_data); 119 gfx::PNGCodec::EncodeBGRASkBitmap(icon, false, &icon_data);
120 120
121 // Base64-encode it (to make it a data URL). 121 // Base64-encode it (to make it a data URL).
122 std::string icon_data_str(reinterpret_cast<char*>(&icon_data[0]), 122 std::string icon_data_str(reinterpret_cast<char*>(&icon_data[0]),
123 icon_data.size()); 123 icon_data.size());
124 std::string icon_base64_encoded; 124 std::string icon_base64_encoded;
125 net::Base64Encode(icon_data_str, &icon_base64_encoded); 125 base::Base64Encode(icon_data_str, &icon_base64_encoded);
126 GURL icon_url("data:image/png;base64," + icon_base64_encoded); 126 GURL icon_url("data:image/png;base64," + icon_base64_encoded);
127 127
128 return icon_url; 128 return icon_url;
129 } 129 }
130 130
131 // This class holds and manages the data passed to the 131 // This class holds and manages the data passed to the
132 // GEARSPLUGINCOMMAND_CREATE_SHORTCUT plugin command. 132 // GEARSPLUGINCOMMAND_CREATE_SHORTCUT plugin command.
133 class CreateShortcutCommand : public CPCommandInterface { 133 class CreateShortcutCommand : public CPCommandInterface {
134 public: 134 public:
135 CreateShortcutCommand( 135 CreateShortcutCommand(
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 struct RunnableMethodTraits<QueryShortcutsCommand> { 300 struct RunnableMethodTraits<QueryShortcutsCommand> {
301 void RetainCallee(QueryShortcutsCommand* command) {} 301 void RetainCallee(QueryShortcutsCommand* command) {}
302 void ReleaseCallee(QueryShortcutsCommand* command) {} 302 void ReleaseCallee(QueryShortcutsCommand* command) {}
303 }; 303 };
304 304
305 void GearsQueryShortcuts(GearsQueryShortcutsCallback* callback) { 305 void GearsQueryShortcuts(GearsQueryShortcutsCallback* callback) {
306 CPHandleCommand(GEARSPLUGINCOMMAND_GET_SHORTCUT_LIST, 306 CPHandleCommand(GEARSPLUGINCOMMAND_GET_SHORTCUT_LIST,
307 new QueryShortcutsCommand(callback), 307 new QueryShortcutsCommand(callback),
308 NULL); 308 NULL);
309 } 309 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/sandboxed_extension_unpacker.cc ('k') | chrome/browser/importer/nss_decryptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698