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

Side by Side Diff: chrome/browser/ui/webui/web_ui_util.cc

Issue 7064052: Revert 88142 to fix sync_integration_tests offline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 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 | « chrome/browser/ui/webui/web_ui_util.h ('k') | chrome/common/about_handler.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/webui/web_ui_util.h" 5 #include "chrome/browser/ui/webui/web_ui_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/string_util.h"
11 #include "chrome/common/url_constants.h"
12 #include "googleurl/src/gurl.h"
10 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
11 #include "ui/gfx/codec/png_codec.h" 14 #include "ui/gfx/codec/png_codec.h"
12 15
13 namespace web_ui_util { 16 namespace web_ui_util {
14 17
15 std::string GetImageDataUrl(const SkBitmap& bitmap) { 18 std::string GetImageDataUrl(const SkBitmap& bitmap) {
16 std::vector<unsigned char> output; 19 std::vector<unsigned char> output;
17 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &output); 20 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &output);
18 std::string str_url; 21 std::string str_url;
19 str_url.insert(str_url.end(), output.begin(), output.end()); 22 str_url.insert(str_url.end(), output.begin(), output.end());
(...skipping 12 matching lines...) Expand all
32 scoped_refptr<RefCountedMemory> raw_icon(icon_data); 35 scoped_refptr<RefCountedMemory> raw_icon(icon_data);
33 std::string str_url; 36 std::string str_url;
34 str_url.insert(str_url.end(), 37 str_url.insert(str_url.end(),
35 raw_icon->front(), 38 raw_icon->front(),
36 raw_icon->front() + raw_icon->size()); 39 raw_icon->front() + raw_icon->size());
37 base::Base64Encode(str_url, &str_url); 40 base::Base64Encode(str_url, &str_url);
38 str_url.insert(0, "data:image/png;base64,"); 41 str_url.insert(0, "data:image/png;base64,");
39 return str_url; 42 return str_url;
40 } 43 }
41 44
45 bool ChromeURLHostEquals(const GURL& url, const char* host) {
46 return (url.SchemeIs(chrome::kChromeUIScheme) ||
47 url.SchemeIs(chrome::kAboutScheme)) &&
48 LowerCaseEqualsASCII(url.host(), host);
49 }
50
42 } // namespace web_ui_util 51 } // namespace web_ui_util
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/web_ui_util.h ('k') | chrome/common/about_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698