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