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

Side by Side Diff: chrome/browser/ui/views/content_setting_bubble_contents.cc

Issue 2169453003: Hide protocol handler icon in location bar after user is done (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/content_setting_bubble_contents.h" 5 #include "chrome/browser/ui/views/content_setting_bubble_contents.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 ContentSettingBubbleContents::ContentSettingBubbleContents( 155 ContentSettingBubbleContents::ContentSettingBubbleContents(
156 ContentSettingBubbleModel* content_setting_bubble_model, 156 ContentSettingBubbleModel* content_setting_bubble_model,
157 content::WebContents* web_contents, 157 content::WebContents* web_contents,
158 views::View* anchor_view, 158 views::View* anchor_view,
159 views::BubbleBorder::Arrow arrow) 159 views::BubbleBorder::Arrow arrow)
160 : content::WebContentsObserver(web_contents), 160 : content::WebContentsObserver(web_contents),
161 BubbleDialogDelegateView(anchor_view, arrow), 161 BubbleDialogDelegateView(anchor_view, arrow),
162 content_setting_bubble_model_(content_setting_bubble_model), 162 content_setting_bubble_model_(content_setting_bubble_model),
163 custom_link_(NULL), 163 custom_link_(NULL),
164 manage_link_(NULL), 164 manage_link_(NULL),
165 learn_more_link_(NULL), 165 learn_more_link_(NULL) {
166 close_button_(NULL) {
167 // Compensate for built-in vertical padding in the anchor view's image. 166 // Compensate for built-in vertical padding in the anchor view's image.
168 set_anchor_view_insets(gfx::Insets( 167 set_anchor_view_insets(gfx::Insets(
169 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); 168 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0));
170 } 169 }
171 170
172 ContentSettingBubbleContents::~ContentSettingBubbleContents() { 171 ContentSettingBubbleContents::~ContentSettingBubbleContents() {
173 // Must remove the children here so the comboboxes get destroyed before 172 // Must remove the children here so the comboboxes get destroyed before
174 // their associated models. 173 // their associated models.
175 RemoveAllChildViews(true); 174 RemoveAllChildViews(true);
176 } 175 }
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 } 372 }
374 } 373 }
375 374
376 views::View* ContentSettingBubbleContents::CreateExtraView() { 375 views::View* ContentSettingBubbleContents::CreateExtraView() {
377 manage_link_ = new views::Link(base::UTF8ToUTF16( 376 manage_link_ = new views::Link(base::UTF8ToUTF16(
378 content_setting_bubble_model_->bubble_content().manage_link)); 377 content_setting_bubble_model_->bubble_content().manage_link));
379 manage_link_->set_listener(this); 378 manage_link_->set_listener(this);
380 return manage_link_; 379 return manage_link_;
381 } 380 }
382 381
382 bool ContentSettingBubbleContents::Accept() {
383 content_setting_bubble_model_->OnDoneClicked();
384 return true;
385 }
386
387 bool ContentSettingBubbleContents::Close() {
388 return true;
389 }
390
383 int ContentSettingBubbleContents::GetDialogButtons() const { 391 int ContentSettingBubbleContents::GetDialogButtons() const {
384 return ui::DIALOG_BUTTON_OK; 392 return ui::DIALOG_BUTTON_OK;
385 } 393 }
386 394
387 base::string16 ContentSettingBubbleContents::GetDialogButtonLabel( 395 base::string16 ContentSettingBubbleContents::GetDialogButtonLabel(
388 ui::DialogButton button) const { 396 ui::DialogButton button) const {
389 return l10n_util::GetStringUTF16(IDS_DONE); 397 return l10n_util::GetStringUTF16(IDS_DONE);
390 } 398 }
391 399
392 void ContentSettingBubbleContents::DidNavigateMainFrame( 400 void ContentSettingBubbleContents::DidNavigateMainFrame(
393 const content::LoadCommittedDetails& details, 401 const content::LoadCommittedDetails& details,
394 const content::FrameNavigateParams& params) { 402 const content::FrameNavigateParams& params) {
395 // Content settings are based on the main frame, so if it switches then 403 // Content settings are based on the main frame, so if it switches then
396 // close up shop. 404 // close up shop.
397 content_setting_bubble_model_->OnDoneClicked();
398 GetWidget()->Close(); 405 GetWidget()->Close();
399 } 406 }
400 407
401 void ContentSettingBubbleContents::ButtonPressed(views::Button* sender, 408 void ContentSettingBubbleContents::ButtonPressed(views::Button* sender,
402 const ui::Event& event) { 409 const ui::Event& event) {
403 RadioGroup::const_iterator i( 410 RadioGroup::const_iterator i(
404 std::find(radio_group_.begin(), radio_group_.end(), sender)); 411 std::find(radio_group_.begin(), radio_group_.end(), sender));
405 if (i != radio_group_.end()) { 412 DCHECK(i != radio_group_.end());
msw 2016/07/20 20:50:16 nit: DCHECK_NE?
Evan Stade 2016/07/20 20:56:46 DCHECK_NE seems more useful when you have two vari
406 content_setting_bubble_model_->OnRadioClicked(i - radio_group_.begin()); 413 content_setting_bubble_model_->OnRadioClicked(i - radio_group_.begin());
407 return;
408 }
409 DCHECK_EQ(sender, close_button_);
410 content_setting_bubble_model_->OnDoneClicked();
411 GetWidget()->Close();
412 } 414 }
413 415
414 void ContentSettingBubbleContents::LinkClicked(views::Link* source, 416 void ContentSettingBubbleContents::LinkClicked(views::Link* source,
415 int event_flags) { 417 int event_flags) {
416 if (source == learn_more_link_) { 418 if (source == learn_more_link_) {
417 content_setting_bubble_model_->OnLearnMoreLinkClicked(); 419 content_setting_bubble_model_->OnLearnMoreLinkClicked();
418 GetWidget()->Close(); 420 GetWidget()->Close();
419 return; 421 return;
420 } 422 }
421 if (source == custom_link_) { 423 if (source == custom_link_) {
(...skipping 13 matching lines...) Expand all
435 DCHECK(i != list_item_links_.end()); 437 DCHECK(i != list_item_links_.end());
436 content_setting_bubble_model_->OnListItemClicked(i->second); 438 content_setting_bubble_model_->OnListItemClicked(i->second);
437 } 439 }
438 440
439 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) { 441 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) {
440 MediaComboboxModel* model = 442 MediaComboboxModel* model =
441 static_cast<MediaComboboxModel*>(combobox->model()); 443 static_cast<MediaComboboxModel*>(combobox->model());
442 content_setting_bubble_model_->OnMediaMenuClicked( 444 content_setting_bubble_model_->OnMediaMenuClicked(
443 model->type(), model->GetDevices()[combobox->selected_index()].id); 445 model->type(), model->GetDevices()[combobox->selected_index()].id);
444 } 446 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698