Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: chrome/browser/ui/views/dom_view.h

Issue 9146028: Define the public interface for content browser SiteInstance. This interface is implemented by th... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // DOMView is a ChromeView that displays the content of a web DOM. 5 // DOMView is a ChromeView that displays the content of a web DOM.
6 // It should be used with data: URLs. 6 // It should be used with data: URLs.
7 7
8 #ifndef CHROME_BROWSER_UI_VIEWS_DOM_VIEW_H_ 8 #ifndef CHROME_BROWSER_UI_VIEWS_DOM_VIEW_H_
9 #define CHROME_BROWSER_UI_VIEWS_DOM_VIEW_H_ 9 #define CHROME_BROWSER_UI_VIEWS_DOM_VIEW_H_
10 #pragma once 10 #pragma once
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
14 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
15 #include "ui/views/controls/native/native_view_host.h" 15 #include "ui/views/controls/native/native_view_host.h"
16 #include "ui/views/events/event.h" 16 #include "ui/views/events/event.h"
17 17
18 class Profile; 18 class Profile;
19
20 namespace content {
19 class SiteInstance; 21 class SiteInstance;
22 };
20 23
21 class DOMView : public views::NativeViewHost { 24 class DOMView : public views::NativeViewHost {
22 public: 25 public:
23 // Internal class name. 26 // Internal class name.
24 static const char kViewClassName[]; 27 static const char kViewClassName[];
25 28
26 DOMView(); 29 DOMView();
27 virtual ~DOMView(); 30 virtual ~DOMView();
28 31
29 // Overridden from View. 32 // Overridden from View.
30 virtual std::string GetClassName() const OVERRIDE; 33 virtual std::string GetClassName() const OVERRIDE;
31 34
32 // Initialize the view, creating the contents. This should be 35 // Initialize the view, creating the contents. This should be
33 // called once the view has been added to a container. 36 // called once the view has been added to a container.
34 // 37 //
35 // If |instance| is not null, then the view will be loaded in the same 38 // If |instance| is not null, then the view will be loaded in the same
36 // process as the given instance. 39 // process as the given instance.
37 bool Init(Profile* profile, SiteInstance* instance); 40 bool Init(Profile* profile, content::SiteInstance* instance);
38 41
39 // Loads the given URL into the page. You must have previously called Init(). 42 // Loads the given URL into the page. You must have previously called Init().
40 void LoadURL(const GURL& url); 43 void LoadURL(const GURL& url);
41 44
42 // The TabContents displaying the DOM contents; may be null. 45 // The TabContents displaying the DOM contents; may be null.
43 TabContentsWrapper* dom_contents() const { return dom_contents_.get(); } 46 TabContentsWrapper* dom_contents() const { return dom_contents_.get(); }
44 47
45 protected: 48 protected:
46 // Overridden from View. 49 // Overridden from View.
47 virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e) OVERRIDE; 50 virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e) OVERRIDE;
48 virtual void OnFocus() OVERRIDE; 51 virtual void OnFocus() OVERRIDE;
49 virtual void ViewHierarchyChanged(bool is_add, views::View* parent, 52 virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
50 views::View* child) OVERRIDE; 53 views::View* child) OVERRIDE;
51 54
52 // AttachTabContents calls Attach to hook up the NativeViewHost. This is 55 // AttachTabContents calls Attach to hook up the NativeViewHost. This is
53 // here because depending on whether this is a touch build or not the 56 // here because depending on whether this is a touch build or not the
54 // implementation varies slightly, while Detach is the same in both cases. 57 // implementation varies slightly, while Detach is the same in both cases.
55 void AttachTabContents(); 58 void AttachTabContents();
56 59
57 // Returns new allocated TabContents instance, caller is responsible deleting. 60 // Returns new allocated TabContents instance, caller is responsible deleting.
58 // Override in derived classes to replace TabContents with derivative. 61 // Override in derived classes to replace TabContents with derivative.
59 virtual content::WebContents* CreateTabContents( 62 virtual content::WebContents* CreateTabContents(
60 Profile* profile, SiteInstance* instance); 63 Profile* profile, content::SiteInstance* instance);
61 64
62 scoped_ptr<TabContentsWrapper> dom_contents_; 65 scoped_ptr<TabContentsWrapper> dom_contents_;
63 66
64 private: 67 private:
65 bool initialized_; 68 bool initialized_;
66 69
67 DISALLOW_COPY_AND_ASSIGN(DOMView); 70 DISALLOW_COPY_AND_ASSIGN(DOMView);
68 }; 71 };
69 72
70 #endif // CHROME_BROWSER_UI_VIEWS_DOM_VIEW_H_ 73 #endif // CHROME_BROWSER_UI_VIEWS_DOM_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm ('k') | chrome/browser/ui/views/dom_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698