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

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: also remove header include 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
« no previous file with comments | « chrome/browser/ui/views/content_setting_bubble_contents.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11 matching lines...) Expand all
22 #include "components/content_settings/core/browser/host_content_settings_map.h" 22 #include "components/content_settings/core/browser/host_content_settings_map.h"
23 #include "content/public/browser/plugin_service.h" 23 #include "content/public/browser/plugin_service.h"
24 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
25 #include "grit/components_strings.h" 25 #include "grit/components_strings.h"
26 #include "ui/base/cursor/cursor.h" 26 #include "ui/base/cursor/cursor.h"
27 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
28 #include "ui/base/models/simple_menu_model.h" 28 #include "ui/base/models/simple_menu_model.h"
29 #include "ui/base/resource/resource_bundle.h" 29 #include "ui/base/resource/resource_bundle.h"
30 #include "ui/gfx/font_list.h" 30 #include "ui/gfx/font_list.h"
31 #include "ui/gfx/text_utils.h" 31 #include "ui/gfx/text_utils.h"
32 #include "ui/views/controls/button/label_button.h"
33 #include "ui/views/controls/button/menu_button.h" 32 #include "ui/views/controls/button/menu_button.h"
34 #include "ui/views/controls/button/radio_button.h" 33 #include "ui/views/controls/button/radio_button.h"
35 #include "ui/views/controls/combobox/combobox.h" 34 #include "ui/views/controls/combobox/combobox.h"
36 #include "ui/views/controls/image_view.h" 35 #include "ui/views/controls/image_view.h"
37 #include "ui/views/controls/label.h" 36 #include "ui/views/controls/label.h"
38 #include "ui/views/controls/link.h" 37 #include "ui/views/controls/link.h"
39 #include "ui/views/controls/menu/menu_config.h" 38 #include "ui/views/controls/menu/menu_config.h"
40 #include "ui/views/controls/menu/menu_runner.h" 39 #include "ui/views/controls/menu/menu_runner.h"
41 #include "ui/views/controls/separator.h" 40 #include "ui/views/controls/separator.h"
42 #include "ui/views/layout/grid_layout.h" 41 #include "ui/views/layout/grid_layout.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 ContentSettingBubbleContents::ContentSettingBubbleContents( 154 ContentSettingBubbleContents::ContentSettingBubbleContents(
156 ContentSettingBubbleModel* content_setting_bubble_model, 155 ContentSettingBubbleModel* content_setting_bubble_model,
157 content::WebContents* web_contents, 156 content::WebContents* web_contents,
158 views::View* anchor_view, 157 views::View* anchor_view,
159 views::BubbleBorder::Arrow arrow) 158 views::BubbleBorder::Arrow arrow)
160 : content::WebContentsObserver(web_contents), 159 : content::WebContentsObserver(web_contents),
161 BubbleDialogDelegateView(anchor_view, arrow), 160 BubbleDialogDelegateView(anchor_view, arrow),
162 content_setting_bubble_model_(content_setting_bubble_model), 161 content_setting_bubble_model_(content_setting_bubble_model),
163 custom_link_(NULL), 162 custom_link_(NULL),
164 manage_link_(NULL), 163 manage_link_(NULL),
165 learn_more_link_(NULL), 164 learn_more_link_(NULL) {
166 close_button_(NULL) {
167 // Compensate for built-in vertical padding in the anchor view's image. 165 // Compensate for built-in vertical padding in the anchor view's image.
168 set_anchor_view_insets(gfx::Insets( 166 set_anchor_view_insets(gfx::Insets(
169 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); 167 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0));
170 } 168 }
171 169
172 ContentSettingBubbleContents::~ContentSettingBubbleContents() { 170 ContentSettingBubbleContents::~ContentSettingBubbleContents() {
173 // Must remove the children here so the comboboxes get destroyed before 171 // Must remove the children here so the comboboxes get destroyed before
174 // their associated models. 172 // their associated models.
175 RemoveAllChildViews(true); 173 RemoveAllChildViews(true);
176 } 174 }
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 } 371 }
374 } 372 }
375 373
376 views::View* ContentSettingBubbleContents::CreateExtraView() { 374 views::View* ContentSettingBubbleContents::CreateExtraView() {
377 manage_link_ = new views::Link(base::UTF8ToUTF16( 375 manage_link_ = new views::Link(base::UTF8ToUTF16(
378 content_setting_bubble_model_->bubble_content().manage_link)); 376 content_setting_bubble_model_->bubble_content().manage_link));
379 manage_link_->set_listener(this); 377 manage_link_->set_listener(this);
380 return manage_link_; 378 return manage_link_;
381 } 379 }
382 380
381 bool ContentSettingBubbleContents::Accept() {
382 content_setting_bubble_model_->OnDoneClicked();
383 return true;
384 }
385
386 bool ContentSettingBubbleContents::Close() {
387 return true;
388 }
389
383 int ContentSettingBubbleContents::GetDialogButtons() const { 390 int ContentSettingBubbleContents::GetDialogButtons() const {
384 return ui::DIALOG_BUTTON_OK; 391 return ui::DIALOG_BUTTON_OK;
385 } 392 }
386 393
387 base::string16 ContentSettingBubbleContents::GetDialogButtonLabel( 394 base::string16 ContentSettingBubbleContents::GetDialogButtonLabel(
388 ui::DialogButton button) const { 395 ui::DialogButton button) const {
389 return l10n_util::GetStringUTF16(IDS_DONE); 396 return l10n_util::GetStringUTF16(IDS_DONE);
390 } 397 }
391 398
392 void ContentSettingBubbleContents::DidNavigateMainFrame( 399 void ContentSettingBubbleContents::DidNavigateMainFrame(
393 const content::LoadCommittedDetails& details, 400 const content::LoadCommittedDetails& details,
394 const content::FrameNavigateParams& params) { 401 const content::FrameNavigateParams& params) {
395 // Content settings are based on the main frame, so if it switches then 402 // Content settings are based on the main frame, so if it switches then
396 // close up shop. 403 // close up shop.
397 content_setting_bubble_model_->OnDoneClicked();
398 GetWidget()->Close(); 404 GetWidget()->Close();
399 } 405 }
400 406
401 void ContentSettingBubbleContents::ButtonPressed(views::Button* sender, 407 void ContentSettingBubbleContents::ButtonPressed(views::Button* sender,
402 const ui::Event& event) { 408 const ui::Event& event) {
403 RadioGroup::const_iterator i( 409 RadioGroup::const_iterator i(
404 std::find(radio_group_.begin(), radio_group_.end(), sender)); 410 std::find(radio_group_.begin(), radio_group_.end(), sender));
405 if (i != radio_group_.end()) { 411 DCHECK(i != radio_group_.end());
406 content_setting_bubble_model_->OnRadioClicked(i - radio_group_.begin()); 412 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 } 413 }
413 414
414 void ContentSettingBubbleContents::LinkClicked(views::Link* source, 415 void ContentSettingBubbleContents::LinkClicked(views::Link* source,
415 int event_flags) { 416 int event_flags) {
416 if (source == learn_more_link_) { 417 if (source == learn_more_link_) {
417 content_setting_bubble_model_->OnLearnMoreLinkClicked(); 418 content_setting_bubble_model_->OnLearnMoreLinkClicked();
418 GetWidget()->Close(); 419 GetWidget()->Close();
419 return; 420 return;
420 } 421 }
421 if (source == custom_link_) { 422 if (source == custom_link_) {
(...skipping 13 matching lines...) Expand all
435 DCHECK(i != list_item_links_.end()); 436 DCHECK(i != list_item_links_.end());
436 content_setting_bubble_model_->OnListItemClicked(i->second); 437 content_setting_bubble_model_->OnListItemClicked(i->second);
437 } 438 }
438 439
439 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) { 440 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) {
440 MediaComboboxModel* model = 441 MediaComboboxModel* model =
441 static_cast<MediaComboboxModel*>(combobox->model()); 442 static_cast<MediaComboboxModel*>(combobox->model());
442 content_setting_bubble_model_->OnMediaMenuClicked( 443 content_setting_bubble_model_->OnMediaMenuClicked(
443 model->type(), model->GetDevices()[combobox->selected_index()].id); 444 model->type(), model->GetDevices()[combobox->selected_index()].id);
444 } 445 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/content_setting_bubble_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698