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.
5 #include "chrome/browser/chromeos/first_run/first_run_view.h"
7 #include "chrome/browser/extensions/extension_web_contents_observer.h"
8 #include "chrome/browser/ui/webui/chromeos/first_run/first_run_ui.h"
9 #include "chrome/common/url_constants.h"
10 #include "content/public/browser/render_view_host.h"
11 #include "content/public/browser/render_widget_host_view.h"
12 #include "content/public/browser/web_contents.h"
13 #include "third_party/skia/include/core/SkBitmap.h"
14 #include "ui/views/controls/webview/webview.h"
19 FirstRunView::FirstRunView()
23 void FirstRunView::Init(content::BrowserContext* context) {
24 web_view_ = new views::WebView(context);
25 AddChildView(web_view_);
26 web_view_->LoadInitialURL(GURL(chrome::kChromeUIFirstRunURL));
28 content::WebContents* web_contents = web_view_->web_contents();
29 web_contents->SetDelegate(this);
30 extensions::ExtensionWebContentsObserver::CreateForWebContents(web_contents);
33 background.setConfig(SkBitmap::kA8_Config, 1, 1);
34 background.allocPixels();
35 background.eraseARGB(0, 0, 0, 0);
36 web_contents->GetRenderViewHost()->GetView()->
37 SetBackground(background);
40 FirstRunActor* FirstRunView::GetActor() {
41 return static_cast<FirstRunUI*>(
42 web_view_->web_contents()->GetWebUI()->GetController())->get_actor();
45 void FirstRunView::Layout() {
46 web_view_->SetBoundsRect(bounds());
49 void FirstRunView::RequestFocus() {
50 web_view_->RequestFocus();
53 content::WebContents* FirstRunView::GetWebContents() {
54 return web_view_->web_contents();
57 bool FirstRunView::HandleContextMenu(
58 const content::ContextMenuParams& params) {
59 // Discards context menu.
63 } // namespace chromeos