Update broken references to image assets
[chromium-blink-merge.git] / chrome / browser / chromeos / first_run / first_run_view.cc
blob0a586de32c2c1331b388c204cb7601db437d7f52
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/chrome_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/WebKit/public/web/WebInputEvent.h"
14 #include "third_party/skia/include/core/SkBitmap.h"
15 #include "ui/views/controls/webview/webview.h"
16 #include "url/gurl.h"
18 namespace chromeos {
20 FirstRunView::FirstRunView()
21 : web_view_(NULL) {
24 void FirstRunView::Init(content::BrowserContext* context) {
25 web_view_ = new views::WebView(context);
26 AddChildView(web_view_);
27 web_view_->LoadInitialURL(GURL(chrome::kChromeUIFirstRunURL));
29 content::WebContents* web_contents = web_view_->web_contents();
30 web_contents->SetDelegate(this);
31 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents(
32 web_contents);
34 web_contents->GetRenderViewHost()->GetView()->SetBackgroundColor(
35 SK_ColorTRANSPARENT);
38 FirstRunActor* FirstRunView::GetActor() {
39 return static_cast<FirstRunUI*>(
40 web_view_->web_contents()->GetWebUI()->GetController())->get_actor();
43 void FirstRunView::Layout() {
44 web_view_->SetBoundsRect(bounds());
47 void FirstRunView::RequestFocus() {
48 web_view_->RequestFocus();
51 content::WebContents* FirstRunView::GetWebContents() {
52 return web_view_->web_contents();
55 bool FirstRunView::HandleContextMenu(
56 const content::ContextMenuParams& params) {
57 // Discards context menu.
58 return true;
61 bool FirstRunView::PreHandleGestureEvent(
62 content::WebContents* source,
63 const blink::WebGestureEvent& event) {
64 // Disable pinch zooming.
65 return event.type == blink::WebGestureEvent::GesturePinchBegin ||
66 event.type == blink::WebGestureEvent::GesturePinchUpdate ||
67 event.type == blink::WebGestureEvent::GesturePinchEnd;
70 } // namespace chromeos