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

Side by Side Diff: chrome/browser/ui/views/website_settings/chooser_bubble_ui_view.cc

Issue 1530493002: Remove Close button for chooser bubble and call CloseBubble when Cancel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use std::move instead of .Pass() Created 5 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/usb/usb_chooser_bubble_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/website_settings/chooser_bubble_ui_view.h" 5 #include "chrome/browser/ui/views/website_settings/chooser_bubble_ui_view.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 public: 67 public:
68 ChooserBubbleUiViewDelegate(views::View* anchor_view, 68 ChooserBubbleUiViewDelegate(views::View* anchor_view,
69 views::BubbleBorder::Arrow anchor_arrow, 69 views::BubbleBorder::Arrow anchor_arrow,
70 ChooserBubbleUiView* owner, 70 ChooserBubbleUiView* owner,
71 ChooserBubbleDelegate* chooser_bubble_delegate); 71 ChooserBubbleDelegate* chooser_bubble_delegate);
72 ~ChooserBubbleUiViewDelegate() override; 72 ~ChooserBubbleUiViewDelegate() override;
73 73
74 void Close(); 74 void Close();
75 75
76 // BubbleDelegateView: 76 // BubbleDelegateView:
77 bool ShouldShowCloseButton() const override;
78 bool ShouldShowWindowTitle() const override; 77 bool ShouldShowWindowTitle() const override;
79 base::string16 GetWindowTitle() const override; 78 base::string16 GetWindowTitle() const override;
80 void OnWidgetDestroying(views::Widget* widget) override; 79 void OnWidgetDestroying(views::Widget* widget) override;
81 80
82 // ButtonListener: 81 // ButtonListener:
83 void ButtonPressed(views::Button* button, const ui::Event& event) override; 82 void ButtonPressed(views::Button* button, const ui::Event& event) override;
84 83
85 // views::TableViewObserver: 84 // views::TableViewObserver:
86 void OnSelectionChanged() override; 85 void OnSelectionChanged() override;
87 86
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 chooser_table_model_->SetObserver(nullptr); 280 chooser_table_model_->SetObserver(nullptr);
282 } 281 }
283 282
284 void ChooserBubbleUiViewDelegate::Close() { 283 void ChooserBubbleUiViewDelegate::Close() {
285 if (!button_pressed_) 284 if (!button_pressed_)
286 chooser_bubble_delegate_->Close(); 285 chooser_bubble_delegate_->Close();
287 owner_ = nullptr; 286 owner_ = nullptr;
288 GetWidget()->Close(); 287 GetWidget()->Close();
289 } 288 }
290 289
291 bool ChooserBubbleUiViewDelegate::ShouldShowCloseButton() const {
292 return true;
293 }
294
295 bool ChooserBubbleUiViewDelegate::ShouldShowWindowTitle() const { 290 bool ChooserBubbleUiViewDelegate::ShouldShowWindowTitle() const {
296 return true; 291 return true;
297 } 292 }
298 293
299 base::string16 ChooserBubbleUiViewDelegate::GetWindowTitle() const { 294 base::string16 ChooserBubbleUiViewDelegate::GetWindowTitle() const {
300 return l10n_util::GetStringUTF16(IDS_CHOOSER_BUBBLE_PROMPT); 295 return l10n_util::GetStringUTF16(IDS_CHOOSER_BUBBLE_PROMPT);
301 } 296 }
302 297
303 void ChooserBubbleUiViewDelegate::OnWidgetDestroying(views::Widget* widget) { 298 void ChooserBubbleUiViewDelegate::OnWidgetDestroying(views::Widget* widget) {
304 views::BubbleDelegateView::OnWidgetDestroying(widget); 299 views::BubbleDelegateView::OnWidgetDestroying(widget);
305 if (owner_) { 300 if (owner_) {
306 owner_->Close(); 301 owner_->Close();
307 owner_ = nullptr; 302 owner_ = nullptr;
308 } 303 }
309 } 304 }
310 305
311 void ChooserBubbleUiViewDelegate::ButtonPressed(views::Button* button, 306 void ChooserBubbleUiViewDelegate::ButtonPressed(views::Button* button,
312 const ui::Event& event) { 307 const ui::Event& event) {
308 button_pressed_ = true;
309
313 if (button == connect_button_) 310 if (button == connect_button_)
314 chooser_bubble_delegate_->Select(table_view_->selection_model().active()); 311 chooser_bubble_delegate_->Select(table_view_->selection_model().active());
315 else 312 else
316 chooser_bubble_delegate_->Cancel(); 313 chooser_bubble_delegate_->Cancel();
317 button_pressed_ = true; 314
318 owner_->Close(); 315 if (owner_) {
316 owner_->Close();
317 owner_ = nullptr;
318 }
319 } 319 }
320 320
321 void ChooserBubbleUiViewDelegate::OnSelectionChanged() { 321 void ChooserBubbleUiViewDelegate::OnSelectionChanged() {
322 connect_button_->SetEnabled(!table_view_->selection_model().empty()); 322 connect_button_->SetEnabled(!table_view_->selection_model().empty());
323 } 323 }
324 324
325 void ChooserBubbleUiViewDelegate::UpdateAnchor( 325 void ChooserBubbleUiViewDelegate::UpdateAnchor(
326 views::View* anchor_view, 326 views::View* anchor_view,
327 views::BubbleBorder::Arrow anchor_arrow) { 327 views::BubbleBorder::Arrow anchor_arrow) {
328 if (GetAnchorView() == anchor_view && arrow() == anchor_arrow) 328 if (GetAnchorView() == anchor_view && arrow() == anchor_arrow)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 return browser_view->exclusive_access_bubble()->GetView(); 397 return browser_view->exclusive_access_bubble()->GetView();
398 398
399 return browser_view->top_container(); 399 return browser_view->top_container();
400 } 400 }
401 401
402 views::BubbleBorder::Arrow ChooserBubbleUiView::GetAnchorArrow() { 402 views::BubbleBorder::Arrow ChooserBubbleUiView::GetAnchorArrow() {
403 if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) 403 if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR))
404 return views::BubbleBorder::TOP_LEFT; 404 return views::BubbleBorder::TOP_LEFT;
405 return views::BubbleBorder::NONE; 405 return views::BubbleBorder::NONE;
406 } 406 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/usb/usb_chooser_bubble_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698