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

Unified Diff: chrome/browser/ui/intents/web_intent_constrained_dialog_factory.cc

Issue 7715037: Web Intent Picker UI (implemented as a constrained dialog, linux only) (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: linux_views/chromeos fix Created 9 years, 4 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: chrome/browser/ui/intents/web_intent_constrained_dialog_factory.cc
diff --git a/chrome/browser/ui/intents/web_intent_constrained_dialog_factory.cc b/chrome/browser/ui/intents/web_intent_constrained_dialog_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0aa6bbb720e9886a9b792fd2c304d61669c66843
--- /dev/null
+++ b/chrome/browser/ui/intents/web_intent_constrained_dialog_factory.cc
@@ -0,0 +1,47 @@
+// Copyright (c) 2011 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.
+
+#include "chrome/browser/ui/intents/web_intent_constrained_dialog_factory.h"
+
+#include "chrome/browser/ui/intents/web_intent_picker.h"
+#include "content/browser/tab_contents/constrained_window.h"
+#include "content/browser/tab_contents/tab_contents.h"
+
+WebIntentConstrainedDialogFactory::WebIntentConstrainedDialogFactory()
+ : picker_(NULL) {
+}
+
+WebIntentConstrainedDialogFactory::~WebIntentConstrainedDialogFactory() {
+ CloseDialog();
+}
+
+WebIntentPicker* WebIntentConstrainedDialogFactory::Create(
+ TabContents* tab_contents,
+ WebIntentPickerDelegate* delegate) {
+ // Only allow one picker per factory.
+ DCHECK(picker_ == NULL);
+
+ picker_ = WebIntentPicker::Create(tab_contents, delegate);
+
+ // TODO(binji) Remove this check when there are implementations of the picker
+ // for windows and mac.
+ if (picker_ == NULL)
+ return NULL;
+
+ picker_->Show();
+
+ return picker_;
+}
+
+void WebIntentConstrainedDialogFactory::ClosePicker(WebIntentPicker* picker) {
+ DCHECK(picker == picker_);
+ CloseDialog();
+}
+
+void WebIntentConstrainedDialogFactory::CloseDialog() {
+ if (picker_) {
+ picker_->Close();
+ picker_ = NULL;
+ }
+}
« no previous file with comments | « chrome/browser/ui/intents/web_intent_constrained_dialog_factory.h ('k') | chrome/browser/ui/intents/web_intent_picker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698