OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/api/capture_web_contents_function.h" | 5 #include "chrome/browser/extensions/api/capture_web_contents_function.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 9 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
10 #include "chrome/common/extensions/extension_constants.h" | |
11 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
12 #include "content/public/browser/render_widget_host_view.h" | 11 #include "content/public/browser/render_widget_host_view.h" |
13 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
14 #include "extensions/browser/extension_function.h" | 13 #include "extensions/browser/extension_function.h" |
| 14 #include "extensions/common/constants.h" |
15 #include "ui/gfx/codec/jpeg_codec.h" | 15 #include "ui/gfx/codec/jpeg_codec.h" |
16 #include "ui/gfx/codec/png_codec.h" | 16 #include "ui/gfx/codec/png_codec.h" |
17 | 17 |
18 using content::RenderViewHost; | 18 using content::RenderViewHost; |
19 using content::RenderWidgetHost; | 19 using content::RenderWidgetHost; |
20 using content::RenderWidgetHostView; | 20 using content::RenderWidgetHostView; |
21 using content::WebContents; | 21 using content::WebContents; |
22 | 22 |
23 namespace extensions { | 23 namespace extensions { |
24 | 24 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 reinterpret_cast<const char*>(vector_as_array(&data)), data.size()); | 150 reinterpret_cast<const char*>(vector_as_array(&data)), data.size()); |
151 | 151 |
152 base::Base64Encode(stream_as_string, &base64_result); | 152 base::Base64Encode(stream_as_string, &base64_result); |
153 base64_result.insert(0, base::StringPrintf("data:%s;base64,", | 153 base64_result.insert(0, base::StringPrintf("data:%s;base64,", |
154 mime_type.c_str())); | 154 mime_type.c_str())); |
155 SetResult(new base::StringValue(base64_result)); | 155 SetResult(new base::StringValue(base64_result)); |
156 SendResponse(true); | 156 SendResponse(true); |
157 } | 157 } |
158 | 158 |
159 } // namespace extensions | 159 } // namespace extensions |
OLD | NEW |