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

Unified Diff: chrome/browser/ui/views/web_intent_picker_views.cc

Issue 10965052: Provide hook to abort dialog cancellation, disable cancellation during install. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Combined if clauses. Created 8 years, 3 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
« no previous file with comments | « no previous file | ui/views/window/dialog_client_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/web_intent_picker_views.cc
diff --git a/chrome/browser/ui/views/web_intent_picker_views.cc b/chrome/browser/ui/views/web_intent_picker_views.cc
index 64e45071650350e2cff4f9139a2ee85e8d267dbf..519b4cbba2515109a424af9fd44e0f1dc1403eff 100644
--- a/chrome/browser/ui/views/web_intent_picker_views.cc
+++ b/chrome/browser/ui/views/web_intent_picker_views.cc
@@ -772,6 +772,7 @@ class WebIntentPickerViews : public views::ButtonListener,
virtual const views::Widget* GetWidget() const OVERRIDE;
virtual views::View* GetContentsView() OVERRIDE;
virtual int GetDialogButtons() const OVERRIDE;
+ virtual bool Cancel() OVERRIDE;
// LinkListener implementation.
virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
@@ -881,6 +882,9 @@ class WebIntentPickerViews : public views::ButtonListener,
// from then on always true.
bool use_close_button_;
+ // Signals if the picker can be closed. False during extension install.
+ bool can_close_;
+
DISALLOW_COPY_AND_ASSIGN(WebIntentPickerViews);
};
@@ -906,7 +910,8 @@ WebIntentPickerViews::WebIntentPickerViews(TabContents* tab_contents,
more_suggestions_link_(NULL),
choose_another_service_link_(NULL),
waiting_view_(NULL),
- displaying_web_contents_(false) {
+ displaying_web_contents_(false),
+ can_close_(true) {
use_close_button_ = CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableFramelessConstrainedDialogs);
@@ -950,6 +955,10 @@ int WebIntentPickerViews::GetDialogButtons() const {
return ui::DIALOG_BUTTON_NONE;
}
+bool WebIntentPickerViews::Cancel() {
+ return can_close_;
+}
+
void WebIntentPickerViews::LinkClicked(views::Link* source, int event_flags) {
if (source == more_suggestions_link_) {
delegate_->OnSuggestionsLinkClicked(
@@ -975,11 +984,13 @@ void WebIntentPickerViews::SetActionString(const string16& action) {
}
void WebIntentPickerViews::OnExtensionInstallSuccess(const std::string& id) {
+ can_close_ = true;
}
void WebIntentPickerViews::OnExtensionInstallFailure(const std::string& id) {
extensions_->StopThrobber();
more_suggestions_link_->SetEnabled(true);
+ can_close_ = true;
contents_->Layout();
// TODO(binji): What to display to user on failure?
@@ -1175,6 +1186,7 @@ void WebIntentPickerViews::OnInlineDisposition(
void WebIntentPickerViews::OnExtensionInstallClicked(
const string16& extension_id) {
+ can_close_ = false;
extensions_->StartThrobber(extension_id);
more_suggestions_link_->SetEnabled(false);
contents_->Layout();
« no previous file with comments | « no previous file | ui/views/window/dialog_client_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698