- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / first_run / first_run_view.cc
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/first_run/first_run_view.h"
6
7 #include "chrome/browser/ui/webui/chromeos/first_run/first_run_ui.h"
8 #include "chrome/common/url_constants.h"
9 #include "content/public/browser/render_view_host.h"
10 #include "content/public/browser/render_widget_host_view.h"
11 #include "content/public/browser/web_contents.h"
12 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "ui/views/controls/webview/webview.h"
14 #include "url/gurl.h"
15
16 namespace chromeos {
17
18 FirstRunView::FirstRunView()
19     : web_view_(NULL) {
20 }
21
22 void FirstRunView::Init(content::BrowserContext* context) {
23   web_view_ = new views::WebView(context);
24   AddChildView(web_view_);
25   web_view_->LoadInitialURL(GURL(chrome::kChromeUIFirstRunURL));
26   web_view_->RequestFocus();
27
28   web_view_->web_contents()->SetDelegate(this);
29
30   SkBitmap background;
31   background.setConfig(SkBitmap::kA8_Config, 1, 1);
32   background.allocPixels();
33   background.eraseARGB(0, 0, 0, 0);
34   web_view_->web_contents()->GetRenderViewHost()->GetView()->
35     SetBackground(background);
36 }
37
38 FirstRunActor* FirstRunView::GetActor() {
39   return static_cast<FirstRunUI*>(
40       web_view_->web_contents()->GetWebUI()->GetController())->get_actor();
41 }
42
43 void FirstRunView::Layout() {
44   web_view_->SetBoundsRect(bounds());
45 }
46
47 bool FirstRunView::HandleContextMenu(
48     const content::ContextMenuParams& params) {
49   // Discards context menu.
50   return true;
51 }
52
53 }  // namespace chromeos
54