1 // Copyright 2017 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.
4 
5 #include "chrome/browser/android/compositor/resources/toolbar_resource.h"
6 
7 #include <memory>
8 
9 namespace android {
10 
11 // static
From(ui::Resource * resource)12 ToolbarResource* ToolbarResource::From(ui::Resource* resource) {
13   if (!resource)
14     return nullptr;
15 
16   DCHECK_EQ(Type::TOOLBAR, resource->type());
17   return static_cast<ToolbarResource*>(resource);
18 }
19 
ToolbarResource(gfx::Rect toolbar_rect,gfx::Rect location_bar_content_rect,int shadow_height)20 ToolbarResource::ToolbarResource(gfx::Rect toolbar_rect,
21                                  gfx::Rect location_bar_content_rect,
22                                  int shadow_height)
23     : Resource(Type::TOOLBAR),
24       toolbar_rect_(toolbar_rect),
25       location_bar_content_rect_(location_bar_content_rect),
26       shadow_height_(shadow_height) {}
27 
28 ToolbarResource::~ToolbarResource() = default;
29 
CreateForCopy()30 std::unique_ptr<ui::Resource> ToolbarResource::CreateForCopy() {
31   return std::make_unique<ToolbarResource>(
32       toolbar_rect_, location_bar_content_rect_, shadow_height_);
33 }
34 
35 }  // namespace android
36