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

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

Issue 7068007: Revise about: and chrome: url handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update special_tabs.py from Nirnimesh's codereview.chromium.org/6995057/. 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"
13 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/gfx/codec/png_codec.h" 11 #include "ui/gfx/codec/png_codec.h"
15 12
16 namespace web_ui_util { 13 namespace web_ui_util {
17 14
18 std::string GetImageDataUrl(const SkBitmap& bitmap) { 15 std::string GetImageDataUrl(const SkBitmap& bitmap) {
19 std::vector<unsigned char> output; 16 std::vector<unsigned char> output;
20 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &output); 17 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &output);
21 std::string str_url; 18 std::string str_url;
22 str_url.insert(str_url.end(), output.begin(), output.end()); 19 str_url.insert(str_url.end(), output.begin(), output.end());
(...skipping 12 matching lines...) Expand all
35 scoped_refptr<RefCountedMemory> raw_icon(icon_data); 32 scoped_refptr<RefCountedMemory> raw_icon(icon_data);
36 std::string str_url; 33 std::string str_url;
37 str_url.insert(str_url.end(), 34 str_url.insert(str_url.end(),
38 raw_icon->front(), 35 raw_icon->front(),
39 raw_icon->front() + raw_icon->size()); 36 raw_icon->front() + raw_icon->size());
40 base::Base64Encode(str_url, &str_url); 37 base::Base64Encode(str_url, &str_url);
41 str_url.insert(0, "data:image/png;base64,"); 38 str_url.insert(0, "data:image/png;base64,");
42 return str_url; 39 return str_url;
43 } 40 }
44 41
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
51 } // namespace web_ui_util 42 } // 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