| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // event (used for keyboard shortcuts). | 129 // event (used for keyboard shortcuts). |
| 130 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) = 0; | 130 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) = 0; |
| 131 | 131 |
| 132 // Notifications about mouse events in this view. This is useful for | 132 // Notifications about mouse events in this view. This is useful for |
| 133 // implementing global 'on hover' features external to the view. | 133 // implementing global 'on hover' features external to the view. |
| 134 virtual void HandleMouseEvent() = 0; | 134 virtual void HandleMouseEvent() = 0; |
| 135 virtual void HandleMouseLeave() = 0; | 135 virtual void HandleMouseLeave() = 0; |
| 136 | 136 |
| 137 // The content's intrinsic width (prefWidth) changed. | 137 // The content's intrinsic width (prefWidth) changed. |
| 138 virtual void UpdatePreferredWidth(int pref_width) = 0; | 138 virtual void UpdatePreferredWidth(int pref_width) = 0; |
| 139 | |
| 140 protected: | |
| 141 ~View() {} | |
| 142 }; | 139 }; |
| 143 | 140 |
| 144 // RendererManagerment ------------------------------------------------------- | 141 // RendererManagerment ------------------------------------------------------- |
| 145 // Functions for managing switching of Renderers. For TabContents, this is | 142 // Functions for managing switching of Renderers. For TabContents, this is |
| 146 // implemented by the RenderViewHostManager | 143 // implemented by the RenderViewHostManager |
| 147 | 144 |
| 148 class RendererManagement { | 145 class RendererManagement { |
| 149 public: | 146 public: |
| 150 // Notification whether we should close the page, after an explicit call to | 147 // Notification whether we should close the page, after an explicit call to |
| 151 // AttemptToClosePage. This is called before a cross-site request or before | 148 // AttemptToClosePage. This is called before a cross-site request or before |
| 152 // a tab/window is closed (as indicated by the first parameter) to allow the | 149 // a tab/window is closed (as indicated by the first parameter) to allow the |
| 153 // appropriate renderer to approve or deny the request. |proceed| indicates | 150 // appropriate renderer to approve or deny the request. |proceed| indicates |
| 154 // whether the user chose to proceed. | 151 // whether the user chose to proceed. |
| 155 virtual void ShouldClosePage(bool for_cross_site_transition, | 152 virtual void ShouldClosePage(bool for_cross_site_transition, |
| 156 bool proceed) = 0; | 153 bool proceed) = 0; |
| 157 | 154 |
| 158 // Called by ResourceDispatcherHost when a response for a pending cross-site | 155 // Called by ResourceDispatcherHost when a response for a pending cross-site |
| 159 // request is received. The ResourceDispatcherHost will pause the response | 156 // request is received. The ResourceDispatcherHost will pause the response |
| 160 // until the onunload handler of the previous renderer is run. | 157 // until the onunload handler of the previous renderer is run. |
| 161 virtual void OnCrossSiteResponse(int new_render_process_host_id, | 158 virtual void OnCrossSiteResponse(int new_render_process_host_id, |
| 162 int new_request_id) = 0; | 159 int new_request_id) = 0; |
| 163 | 160 |
| 164 // Called the ResourceDispatcherHost's associate CrossSiteRequestHandler | 161 // Called the ResourceDispatcherHost's associate CrossSiteRequestHandler |
| 165 // when a cross-site navigation has been canceled. | 162 // when a cross-site navigation has been canceled. |
| 166 virtual void OnCrossSiteNavigationCanceled() = 0; | 163 virtual void OnCrossSiteNavigationCanceled() = 0; |
| 167 | |
| 168 protected: | |
| 169 ~RendererManagement() {} | |
| 170 }; | 164 }; |
| 171 | 165 |
| 172 // BrowserIntegration -------------------------------------------------------- | 166 // BrowserIntegration -------------------------------------------------------- |
| 173 // Functions that integrate with other browser services. | 167 // Functions that integrate with other browser services. |
| 174 | 168 |
| 175 class BrowserIntegration { | 169 class BrowserIntegration { |
| 176 public: | 170 public: |
| 177 // Notification the user has made a gesture while focus was on the | 171 // Notification the user has made a gesture while focus was on the |
| 178 // page. This is used to avoid uninitiated user downloads (aka carpet | 172 // page. This is used to avoid uninitiated user downloads (aka carpet |
| 179 // bombing), see DownloadRequestManager for details. | 173 // bombing), see DownloadRequestManager for details. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 206 // BrowserIntegration callbacks, feel free to move it elsewhere. | 200 // BrowserIntegration callbacks, feel free to move it elsewhere. |
| 207 virtual void OnCrashedPlugin(const FilePath& plugin_path) = 0; | 201 virtual void OnCrashedPlugin(const FilePath& plugin_path) = 0; |
| 208 | 202 |
| 209 // Notification that a worker process has crashed. | 203 // Notification that a worker process has crashed. |
| 210 virtual void OnCrashedWorker() = 0; | 204 virtual void OnCrashedWorker() = 0; |
| 211 | 205 |
| 212 // Notification that a request for install info has completed. | 206 // Notification that a request for install info has completed. |
| 213 virtual void OnDidGetApplicationInfo( | 207 virtual void OnDidGetApplicationInfo( |
| 214 int32 page_id, | 208 int32 page_id, |
| 215 const webkit_glue::WebApplicationInfo& app_info) = 0; | 209 const webkit_glue::WebApplicationInfo& app_info) = 0; |
| 216 | |
| 217 protected: | |
| 218 ~BrowserIntegration() {} | |
| 219 }; | 210 }; |
| 220 | 211 |
| 221 // Resource ------------------------------------------------------------------ | 212 // Resource ------------------------------------------------------------------ |
| 222 // Notifications of resource loading events. | 213 // Notifications of resource loading events. |
| 223 | 214 |
| 224 class Resource { | 215 class Resource { |
| 225 public: | 216 public: |
| 226 // The RenderView is starting a provisional load. | 217 // The RenderView is starting a provisional load. |
| 227 virtual void DidStartProvisionalLoadForFrame( | 218 virtual void DidStartProvisionalLoadForFrame( |
| 228 RenderViewHost* render_view_host, | 219 RenderViewHost* render_view_host, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // The RenderView failed a provisional load with an error. | 256 // The RenderView failed a provisional load with an error. |
| 266 virtual void DidFailProvisionalLoadWithError( | 257 virtual void DidFailProvisionalLoadWithError( |
| 267 RenderViewHost* render_view_host, | 258 RenderViewHost* render_view_host, |
| 268 bool is_main_frame, | 259 bool is_main_frame, |
| 269 int error_code, | 260 int error_code, |
| 270 const GURL& url, | 261 const GURL& url, |
| 271 bool showing_repost_interstitial) = 0; | 262 bool showing_repost_interstitial) = 0; |
| 272 | 263 |
| 273 // Notification that a document has been loaded in a frame. | 264 // Notification that a document has been loaded in a frame. |
| 274 virtual void DocumentLoadedInFrame() = 0; | 265 virtual void DocumentLoadedInFrame() = 0; |
| 275 | |
| 276 protected: | |
| 277 ~Resource() {} | |
| 278 }; | 266 }; |
| 279 | 267 |
| 280 // Save ---------------------------------------------------------------------- | 268 // Save ---------------------------------------------------------------------- |
| 281 // Interface for saving web pages. | 269 // Interface for saving web pages. |
| 282 | 270 |
| 283 class Save { | 271 class Save { |
| 284 public: | 272 public: |
| 285 // Notification that we get when we receive all savable links of | 273 // Notification that we get when we receive all savable links of |
| 286 // sub-resources for the current page, their referrers and list of frames | 274 // sub-resources for the current page, their referrers and list of frames |
| 287 // (include main frame and sub frames). | 275 // (include main frame and sub frames). |
| 288 virtual void OnReceivedSavableResourceLinksForCurrentPage( | 276 virtual void OnReceivedSavableResourceLinksForCurrentPage( |
| 289 const std::vector<GURL>& resources_list, | 277 const std::vector<GURL>& resources_list, |
| 290 const std::vector<GURL>& referrers_list, | 278 const std::vector<GURL>& referrers_list, |
| 291 const std::vector<GURL>& frames_list) = 0; | 279 const std::vector<GURL>& frames_list) = 0; |
| 292 | 280 |
| 293 // Notification that we get when we receive serialized html content data of | 281 // Notification that we get when we receive serialized html content data of |
| 294 // a specified web page from render process. The parameter frame_url | 282 // a specified web page from render process. The parameter frame_url |
| 295 // specifies what frame the data belongs. The parameter data contains the | 283 // specifies what frame the data belongs. The parameter data contains the |
| 296 // available data for sending. The parameter status indicates the | 284 // available data for sending. The parameter status indicates the |
| 297 // serialization status, See | 285 // serialization status, See |
| 298 // webkit_glue::DomSerializerDelegate::PageSavingSerializationStatus for | 286 // webkit_glue::DomSerializerDelegate::PageSavingSerializationStatus for |
| 299 // the detail meaning of status. | 287 // the detail meaning of status. |
| 300 virtual void OnReceivedSerializedHtmlData(const GURL& frame_url, | 288 virtual void OnReceivedSerializedHtmlData(const GURL& frame_url, |
| 301 const std::string& data, | 289 const std::string& data, |
| 302 int32 status) = 0; | 290 int32 status) = 0; |
| 303 | |
| 304 protected: | |
| 305 ~Save() {} | |
| 306 }; | 291 }; |
| 307 | 292 |
| 308 // Printing ------------------------------------------------------------------ | 293 // Printing ------------------------------------------------------------------ |
| 309 | 294 |
| 310 class Printing { | 295 class Printing { |
| 311 public: | 296 public: |
| 312 // Notification that the render view has calculated the number of printed | 297 // Notification that the render view has calculated the number of printed |
| 313 // pages. | 298 // pages. |
| 314 virtual void DidGetPrintedPagesCount(int cookie, int number_pages) = 0; | 299 virtual void DidGetPrintedPagesCount(int cookie, int number_pages) = 0; |
| 315 | 300 |
| 316 // Notification that the render view is done rendering one printed page. | 301 // Notification that the render view is done rendering one printed page. |
| 317 // This call is synchronous, the renderer is waiting on us because of the | 302 // This call is synchronous, the renderer is waiting on us because of the |
| 318 // EMF memory mapped data. | 303 // EMF memory mapped data. |
| 319 virtual void DidPrintPage( | 304 virtual void DidPrintPage( |
| 320 const ViewHostMsg_DidPrintPage_Params& params) = 0; | 305 const ViewHostMsg_DidPrintPage_Params& params) = 0; |
| 321 | |
| 322 protected: | |
| 323 ~Printing() {} | |
| 324 }; | 306 }; |
| 325 | 307 |
| 326 // FavIcon ------------------------------------------------------------------- | 308 // FavIcon ------------------------------------------------------------------- |
| 327 // Interface for the renderer to supply favicon information. | 309 // Interface for the renderer to supply favicon information. |
| 328 | 310 |
| 329 class FavIcon { | 311 class FavIcon { |
| 330 public: | 312 public: |
| 331 // An image that was requested to be downloaded by DownloadImage has | 313 // An image that was requested to be downloaded by DownloadImage has |
| 332 // completed. | 314 // completed. |
| 333 // | 315 // |
| 334 // TODO(brettw) this should be renamed DidDownloadFavIcon, and the RVH | 316 // TODO(brettw) this should be renamed DidDownloadFavIcon, and the RVH |
| 335 // function, IPC message, and the RenderView function DownloadImage should | 317 // function, IPC message, and the RenderView function DownloadImage should |
| 336 // all be named DownloadFavIcon. | 318 // all be named DownloadFavIcon. |
| 337 virtual void DidDownloadFavIcon(RenderViewHost* render_view_host, | 319 virtual void DidDownloadFavIcon(RenderViewHost* render_view_host, |
| 338 int id, | 320 int id, |
| 339 const GURL& image_url, | 321 const GURL& image_url, |
| 340 bool errored, | 322 bool errored, |
| 341 const SkBitmap& image) = 0; | 323 const SkBitmap& image) = 0; |
| 342 | 324 |
| 343 // The URL for the FavIcon of a page has changed. | 325 // The URL for the FavIcon of a page has changed. |
| 344 virtual void UpdateFavIconURL(RenderViewHost* render_view_host, | 326 virtual void UpdateFavIconURL(RenderViewHost* render_view_host, |
| 345 int32 page_id, | 327 int32 page_id, |
| 346 const GURL& icon_url) = 0; | 328 const GURL& icon_url) = 0; |
| 347 | |
| 348 protected: | |
| 349 ~FavIcon() {} | |
| 350 }; | 329 }; |
| 351 | 330 |
| 352 // AutoFill ------------------------------------------------------------------ | 331 // AutoFill ------------------------------------------------------------------ |
| 353 // Interface for autofill-related functions. | 332 // Interface for autofill-related functions. |
| 354 | 333 |
| 355 class Autofill { | 334 class Autofill { |
| 356 public: | 335 public: |
| 357 // Forms fillable by autofill have been detected in the page. | 336 // Forms fillable by autofill have been detected in the page. |
| 358 virtual void AutofillFormSubmitted( | 337 virtual void AutofillFormSubmitted( |
| 359 const webkit_glue::AutofillForm& form) = 0; | 338 const webkit_glue::AutofillForm& form) = 0; |
| 360 | 339 |
| 361 // Called to retrieve a list of suggestions from the web database given | 340 // Called to retrieve a list of suggestions from the web database given |
| 362 // the name of the field |field_name| and what the user has already typed | 341 // the name of the field |field_name| and what the user has already typed |
| 363 // in the field |user_text|. Appeals to the database thead to perform the | 342 // in the field |user_text|. Appeals to the database thead to perform the |
| 364 // query. When the database thread is finished, the autofill manager | 343 // query. When the database thread is finished, the autofill manager |
| 365 // retrieves the calling RenderViewHost and then passes the vector of | 344 // retrieves the calling RenderViewHost and then passes the vector of |
| 366 // suggestions to RenderViewHost::AutofillSuggestionsReturned. | 345 // suggestions to RenderViewHost::AutofillSuggestionsReturned. |
| 367 virtual void GetAutofillSuggestions(const std::wstring& field_name, | 346 virtual void GetAutofillSuggestions(const std::wstring& field_name, |
| 368 const std::wstring& user_text, | 347 const std::wstring& user_text, |
| 369 int64 node_id, | 348 int64 node_id, |
| 370 int request_id) = 0; | 349 int request_id) = 0; |
| 371 | 350 |
| 372 // Called when the user has indicated that she wants to remove the specified | 351 // Called when the user has indicated that she wants to remove the specified |
| 373 // autofill suggestion from the database. | 352 // autofill suggestion from the database. |
| 374 virtual void RemoveAutofillEntry(const std::wstring& field_name, | 353 virtual void RemoveAutofillEntry(const std::wstring& field_name, |
| 375 const std::wstring& value) = 0; | 354 const std::wstring& value) = 0; |
| 376 | |
| 377 protected: | |
| 378 ~Autofill() {} | |
| 379 }; | 355 }; |
| 380 | 356 |
| 381 // --------------------------------------------------------------------------- | 357 // --------------------------------------------------------------------------- |
| 382 | 358 |
| 383 // Returns the current delegate associated with a feature. May return NULL if | 359 // Returns the current delegate associated with a feature. May return NULL if |
| 384 // there is no corresponding delegate. | 360 // there is no corresponding delegate. |
| 385 virtual View* GetViewDelegate(); | 361 virtual View* GetViewDelegate(); |
| 386 virtual RendererManagement* GetRendererManagementDelegate(); | 362 virtual RendererManagement* GetRendererManagementDelegate(); |
| 387 virtual BrowserIntegration* GetBrowserIntegrationDelegate(); | 363 virtual BrowserIntegration* GetBrowserIntegrationDelegate(); |
| 388 virtual Resource* GetResourceDelegate(); | 364 virtual Resource* GetResourceDelegate(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 414 virtual void RenderViewCreated(RenderViewHost* render_view_host) {} | 390 virtual void RenderViewCreated(RenderViewHost* render_view_host) {} |
| 415 | 391 |
| 416 // The RenderView has been constructed. | 392 // The RenderView has been constructed. |
| 417 virtual void RenderViewReady(RenderViewHost* render_view_host) {} | 393 virtual void RenderViewReady(RenderViewHost* render_view_host) {} |
| 418 | 394 |
| 419 // The RenderView died somehow (crashed or was killed by the user). | 395 // The RenderView died somehow (crashed or was killed by the user). |
| 420 virtual void RenderViewGone(RenderViewHost* render_view_host) {} | 396 virtual void RenderViewGone(RenderViewHost* render_view_host) {} |
| 421 | 397 |
| 422 // The RenderView is going to be deleted. This is called when each | 398 // The RenderView is going to be deleted. This is called when each |
| 423 // RenderView is going to be destroyed | 399 // RenderView is going to be destroyed |
| 424 virtual void RenderViewDeleted(RenderViewHost* render_view_host) {} | 400 virtual void RenderViewDeleted(RenderViewHost* render_view_host) { } |
| 425 | 401 |
| 426 // The RenderView was navigated to a different page. | 402 // The RenderView was navigated to a different page. |
| 427 virtual void DidNavigate(RenderViewHost* render_view_host, | 403 virtual void DidNavigate(RenderViewHost* render_view_host, |
| 428 const ViewHostMsg_FrameNavigate_Params& params) {} | 404 const ViewHostMsg_FrameNavigate_Params& params) {} |
| 429 | 405 |
| 430 // The state for the page changed and should be updated. | 406 // The state for the page changed and should be updated. |
| 431 virtual void UpdateState(RenderViewHost* render_view_host, | 407 virtual void UpdateState(RenderViewHost* render_view_host, |
| 432 int32 page_id, | 408 int32 page_id, |
| 433 const std::string& state) {} | 409 const std::string& state) {} |
| 434 | 410 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 virtual void RendererResponsive(RenderViewHost* render_view_host) {} | 535 virtual void RendererResponsive(RenderViewHost* render_view_host) {} |
| 560 | 536 |
| 561 // Notification that the RenderViewHost's load state changed. | 537 // Notification that the RenderViewHost's load state changed. |
| 562 virtual void LoadStateChanged(const GURL& url, net::LoadState load_state) {} | 538 virtual void LoadStateChanged(const GURL& url, net::LoadState load_state) {} |
| 563 | 539 |
| 564 // Returns true if this view is used to host an external tab container. | 540 // Returns true if this view is used to host an external tab container. |
| 565 virtual bool IsExternalTabContainer() const; | 541 virtual bool IsExternalTabContainer() const; |
| 566 | 542 |
| 567 // The RenderView has inserted one css file into page. | 543 // The RenderView has inserted one css file into page. |
| 568 virtual void DidInsertCSS() {} | 544 virtual void DidInsertCSS() {} |
| 569 | |
| 570 protected: | |
| 571 ~RenderViewHostDelegate() {} | |
| 572 }; | 545 }; |
| 573 | 546 |
| 574 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ | 547 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ |
| OLD | NEW |