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

Side by Side Diff: chrome/browser/tab_contents/background_contents.h

Issue 7096016: Remove JS dialog dependency from content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: now a tc delegate Created 9 years, 6 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 #ifndef CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_
6 #define CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ 6 #define CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" 13 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h"
14 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" 14 #include "content/browser/javascript_dialogs.h"
15 #include "content/browser/renderer_host/render_view_host_delegate.h" 15 #include "content/browser/renderer_host/render_view_host_delegate.h"
16 #include "content/common/notification_observer.h"
16 #include "content/common/notification_registrar.h" 17 #include "content/common/notification_registrar.h"
17 #include "content/common/window_container_type.h" 18 #include "content/common/window_container_type.h"
18 #include "webkit/glue/window_open_disposition.h" 19 #include "webkit/glue/window_open_disposition.h"
19 20
20 class TabContents; 21 class TabContents;
21 struct WebPreferences; 22 struct WebPreferences;
22 23
23 namespace gfx { 24 namespace gfx {
24 class Rect; 25 class Rect;
25 } 26 }
26 27
27 // This class is a peer of TabContents. It can host a renderer, but does not 28 // This class is a peer of TabContents. It can host a renderer, but does not
28 // have any visible display. Its navigation is not managed by a 29 // have any visible display. Its navigation is not managed by a
29 // NavigationController because is has no facility for navigating (other than 30 // NavigationController because is has no facility for navigating (other than
30 // programatically view window.location.href) or RenderViewHostManager because 31 // programatically view window.location.href) or RenderViewHostManager because
31 // it is never allowed to navigate across a SiteInstance boundary. 32 // it is never allowed to navigate across a SiteInstance boundary.
32 class BackgroundContents : public RenderViewHostDelegate, 33 class BackgroundContents : public RenderViewHostDelegate,
33 public RenderViewHostDelegate::View, 34 public RenderViewHostDelegate::View,
34 public NotificationObserver, 35 public NotificationObserver,
35 public JavaScriptAppModalDialogDelegate { 36 public content::JavaScriptDialogDelegate {
36 public: 37 public:
37 class Delegate { 38 class Delegate {
38 public: 39 public:
39 // Called by ShowCreatedWindow. Asks the delegate to attach the opened 40 // Called by ShowCreatedWindow. Asks the delegate to attach the opened
40 // TabContents to a suitable container (e.g. browser) or to show it if it's 41 // TabContents to a suitable container (e.g. browser) or to show it if it's
41 // a popup window. 42 // a popup window.
42 virtual void AddTabContents(TabContents* new_contents, 43 virtual void AddTabContents(TabContents* new_contents,
43 WindowOpenDisposition disposition, 44 WindowOpenDisposition disposition,
44 const gfx::Rect& initial_pos, 45 const gfx::Rect& initial_pos,
45 bool user_gesture) = 0; 46 bool user_gesture) = 0;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 virtual void HandleMouseLeave() {} 118 virtual void HandleMouseLeave() {}
118 virtual void HandleMouseUp() {} 119 virtual void HandleMouseUp() {}
119 virtual void HandleMouseActivate() {} 120 virtual void HandleMouseActivate() {}
120 virtual void UpdatePreferredSize(const gfx::Size& new_size) {} 121 virtual void UpdatePreferredSize(const gfx::Size& new_size) {}
121 122
122 // NotificationObserver 123 // NotificationObserver
123 virtual void Observe(NotificationType type, 124 virtual void Observe(NotificationType type,
124 const NotificationSource& source, 125 const NotificationSource& source,
125 const NotificationDetails& details); 126 const NotificationDetails& details);
126 127
127 // Overridden from JavaScriptAppModalDialogDelegate: 128 // Overridden from JavaScriptDialogDelegate:
128 virtual void OnMessageBoxClosed(IPC::Message* reply_msg, 129 virtual void OnDialogClosed(IPC::Message* reply_msg,
129 bool success, 130 bool success,
130 const std::wstring& user_input); 131 const string16& user_input) OVERRIDE;
131 virtual void SetSuppressMessageBoxes(bool suppress_message_boxes) {} 132 virtual gfx::NativeWindow GetDialogRootWindow() OVERRIDE;
132 virtual gfx::NativeWindow GetMessageBoxRootWindow(); 133 virtual TabContents* AsTabContents() OVERRIDE;
133 virtual TabContents* AsTabContents(); 134 virtual ExtensionHost* AsExtensionHost() OVERRIDE;
134 virtual ExtensionHost* AsExtensionHost();
135 135
136 virtual void UpdateInspectorSetting(const std::string& key, 136 virtual void UpdateInspectorSetting(const std::string& key,
137 const std::string& value); 137 const std::string& value);
138 virtual void ClearInspectorSettings(); 138 virtual void ClearInspectorSettings();
139 139
140 // Helper to find the BackgroundContents that originated the given request. 140 // Helper to find the BackgroundContents that originated the given request.
141 // Can be NULL if the page has been closed or some other error occurs. 141 // Can be NULL if the page has been closed or some other error occurs.
142 // Should only be called from the UI thread, since it accesses 142 // Should only be called from the UI thread, since it accesses
143 // BackgroundContents. 143 // BackgroundContents.
144 static BackgroundContents* GetBackgroundContentsByID(int render_process_id, 144 static BackgroundContents* GetBackgroundContentsByID(int render_process_id,
(...skipping 27 matching lines...) Expand all
172 BackgroundContents* contents; 172 BackgroundContents* contents;
173 173
174 // The name of the parent frame for these contents. 174 // The name of the parent frame for these contents.
175 const string16& frame_name; 175 const string16& frame_name;
176 176
177 // The ID of the parent application (if any). 177 // The ID of the parent application (if any).
178 const string16& application_id; 178 const string16& application_id;
179 }; 179 };
180 180
181 #endif // CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ 181 #endif // CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698