| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 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. |
| 4 |
| 5 #ifndef UI_WEB_DIALOGS_WEB_DIALOG_WEB_CONTENTS_DELEGATE_H_ |
| 6 #define UI_WEB_DIALOGS_WEB_DIALOG_WEB_CONTENTS_DELEGATE_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/compiler_specific.h" |
| 10 |
| 11 #include "ui/views/views_export.h" |
| 12 |
| 13 #include "content/public/browser/web_contents_delegate.h" |
| 14 |
| 15 namespace content { |
| 16 class BrowserContext; |
| 17 } |
| 18 |
| 19 namespace views { |
| 20 |
| 21 // This class implements (and mostly ignores) most of |
| 22 // content::WebContentsDelegate for use in a Web dialog. Subclasses need only |
| 23 // override a few methods instead of the everything from |
| 24 // content::WebContentsDelegate; this way, implementations on all platforms |
| 25 // behave consistently. |
| 26 class VIEWS_EXPORT WebDialogWebContentsDelegate |
| 27 : public content::WebContentsDelegate { |
| 28 public: |
| 29 // Context must be non-NULL. |
| 30 explicit WebDialogWebContentsDelegate(content::BrowserContext* context); |
| 31 |
| 32 virtual ~WebDialogWebContentsDelegate(); |
| 33 |
| 34 // The returned profile is guaranteed to be original if non-NULL. |
| 35 content::BrowserContext* context() const; |
| 36 |
| 37 // Calling this causes all following events sent from the |
| 38 // WebContents object to be ignored. It also makes all following |
| 39 // calls to context() return NULL. |
| 40 void Detach(); |
| 41 |
| 42 // content::WebContentsDelegate declarations. |
| 43 virtual bool IsPopupOrPanel( |
| 44 const content::WebContents* source) const OVERRIDE; |
| 45 virtual bool ShouldAddNavigationToHistory( |
| 46 const history::HistoryAddPageArgs& add_page_args, |
| 47 content::NavigationType navigation_type) OVERRIDE; |
| 48 |
| 49 private: |
| 50 content::BrowserContext* context_; // Weak pointer. Always an original profi
le. |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(WebDialogWebContentsDelegate); |
| 53 }; |
| 54 } //namespace views |
| 55 #endif // UI_WEB_DIALOGS_WEB_DIALOG_WEB_CONTENTS_DELEGATE_H_ |
| OLD | NEW |