| Index: ui/web_dialogs/web_dialog_web_contents_delegate.h
|
| ===================================================================
|
| --- ui/web_dialogs/web_dialog_web_contents_delegate.h (revision 0)
|
| +++ ui/web_dialogs/web_dialog_web_contents_delegate.h (revision 0)
|
| @@ -0,0 +1,53 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef UI_WEB_DIALOGS_WEB_DIALOG_WEB_CONTENTS_DELEGATE_H_
|
| +#define UI_WEB_DIALOGS_WEB_DIALOG_WEB_CONTENTS_DELEGATE_H_
|
| +#pragma once
|
| +
|
| +#include "base/compiler_specific.h"
|
| +#include "content/public/browser/web_contents_delegate.h"
|
| +#include "ui/web_dialogs/web_dialogs_export.h"
|
| +
|
| +namespace content {
|
| + class BrowserContext;
|
| +}
|
| +
|
| +namespace web_dialogs {
|
| +
|
| +// This class implements (and mostly ignores) most of
|
| +// content::WebContentsDelegate for use in a Web dialog. Subclasses need only
|
| +// override a few methods instead of the everything from
|
| +// content::WebContentsDelegate; this way, implementations on all platforms
|
| +// behave consistently.
|
| +class WEB_DIALOGS_EXPORT WebDialogWebContentsDelegate
|
| + : public content::WebContentsDelegate {
|
| + public:
|
| + // Context must be non-NULL.
|
| + explicit WebDialogWebContentsDelegate(content::BrowserContext* context);
|
| +
|
| + virtual ~WebDialogWebContentsDelegate();
|
| +
|
| + // The returned profile is guaranteed to be original if non-NULL.
|
| + content::BrowserContext* context() const;
|
| +
|
| + // Calling this causes all following events sent from the
|
| + // WebContents object to be ignored. It also makes all following
|
| + // calls to context() return NULL.
|
| + void Detach();
|
| +
|
| + // content::WebContentsDelegate declarations.
|
| + virtual bool IsPopupOrPanel(
|
| + const content::WebContents* source) const OVERRIDE;
|
| + virtual bool ShouldAddNavigationToHistory(
|
| + const history::HistoryAddPageArgs& add_page_args,
|
| + content::NavigationType navigation_type) OVERRIDE;
|
| +
|
| + private:
|
| + content::BrowserContext* context_; // Weak pointer.
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(WebDialogWebContentsDelegate);
|
| +};
|
| +} // namespace web_dialogs
|
| +#endif // UI_WEB_DIALOGS_WEB_DIALOG_WEB_CONTENTS_DELEGATE_H_
|
|
|