Drive: Add BatchableRequest subclass.
[chromium-blink-merge.git] / ui / base / nine_image_painter_factory.cc
blob3b47160e31fc443408970d95537807304176944b
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/base/nine_image_painter_factory.h"
7 #include "ui/base/resource/resource_bundle.h"
8 #include "ui/gfx/nine_image_painter.h"
10 namespace ui {
12 namespace {
14 std::vector<gfx::ImageSkia> ImageIdsToImages(const int image_ids[]) {
15 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
16 std::vector<gfx::ImageSkia> images(9);
17 for (size_t i = 0; i < 9; ++i) {
18 if (image_ids[i] != 0)
19 images[i] = *rb.GetImageSkiaNamed(image_ids[i]);
21 return images;
24 } // namespace
26 scoped_ptr<gfx::NineImagePainter> CreateNineImagePainter(
27 const int image_ids[]) {
28 return make_scoped_ptr(
29 new gfx::NineImagePainter(ImageIdsToImages(image_ids)));
32 } // namespace ui