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

Unified Diff: ui/web_dialogs/web_dialog_web_contents_delegate.h

Issue 10353007: Extract a minimal subset of WebDialogUI/WebDialogDelegate from src/chrome -> src/ui/web_dialogs Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
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,55 @@
+// 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 "ui/views/views_export.h"
+
+#include "content/public/browser/web_contents_delegate.h"
+
+namespace content {
+ class BrowserContext;
+}
+
+namespace views {
+
+// 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 VIEWS_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. Always an original profile.
+
+ DISALLOW_COPY_AND_ASSIGN(WebDialogWebContentsDelegate);
+};
+} //namespace views
+#endif // UI_WEB_DIALOGS_WEB_DIALOG_WEB_CONTENTS_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698