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

Side by Side Diff: chrome/browser/ui/views/ime/ime_warning_bubble_view.cc

Issue 2374253002: Fix bookmark bubble/star view highlighting for Harmony. (Closed)
Patch Set: fix tests, move bubble creation to toolbar Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ime/ime_warning_bubble_view.h" 5 #include "chrome/browser/ui/views/ime/ime_warning_bubble_view.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h" 10 #include "chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 const ImeWarningBubbleResponseCallback& callback) 94 const ImeWarningBubbleResponseCallback& callback)
95 : extension_(extension), 95 : extension_(extension),
96 browser_view_(browser_view), 96 browser_view_(browser_view),
97 browser_(browser_view->browser()), 97 browser_(browser_view->browser()),
98 anchor_to_browser_action_(false), 98 anchor_to_browser_action_(false),
99 never_show_checkbox_(nullptr), 99 never_show_checkbox_(nullptr),
100 response_callback_(callback), 100 response_callback_(callback),
101 bubble_has_shown_(false), 101 bubble_has_shown_(false),
102 toolbar_actions_bar_observer_(this), 102 toolbar_actions_bar_observer_(this),
103 weak_ptr_factory_(this) { 103 weak_ptr_factory_(this) {
104 container_ = browser_view_->GetToolbarView()->browser_actions(); 104 container_ = browser_view_->toolbar()->browser_actions();
105 toolbar_actions_bar_ = container_->toolbar_actions_bar(); 105 toolbar_actions_bar_ = container_->toolbar_actions_bar();
106 BrowserList::AddObserver(this); 106 BrowserList::AddObserver(this);
107 107
108 // The lifetime of this bubble is tied to the lifetime of the browser. 108 // The lifetime of this bubble is tied to the lifetime of the browser.
109 set_parent_window( 109 set_parent_window(
110 platform_util::GetViewForWindow(browser_view_->GetNativeWindow())); 110 platform_util::GetViewForWindow(browser_view_->GetNativeWindow()));
111 InitAnchorView(); 111 InitAnchorView();
112 InitLayout(); 112 InitLayout();
113 113
114 // If the toolbar is not animating, shows the warning bubble directly. 114 // If the toolbar is not animating, shows the warning bubble directly.
(...skipping 20 matching lines...) Expand all
135 135
136 anchor_to_browser_action_ = 136 anchor_to_browser_action_ =
137 extensions::ActionInfo::GetBrowserActionInfo(extension_) || 137 extensions::ActionInfo::GetBrowserActionInfo(extension_) ||
138 extensions::FeatureSwitch::extension_action_redesign()->IsEnabled(); 138 extensions::FeatureSwitch::extension_action_redesign()->IsEnabled();
139 if (anchor_to_browser_action_) { 139 if (anchor_to_browser_action_) {
140 // Anchors the bubble to the browser action of the extension. 140 // Anchors the bubble to the browser action of the extension.
141 reference_view = container_->GetViewForId(extension_->id()); 141 reference_view = container_->GetViewForId(extension_->id());
142 } 142 }
143 if (!reference_view || !reference_view->visible()) { 143 if (!reference_view || !reference_view->visible()) {
144 // Anchors the bubble to the app menu. 144 // Anchors the bubble to the app menu.
145 reference_view = browser_view_->GetToolbarView()->app_menu_button(); 145 reference_view = browser_view_->toolbar()->app_menu_button();
146 } 146 }
147 SetAnchorView(reference_view); 147 SetAnchorView(reference_view);
148 set_arrow(views::BubbleBorder::TOP_RIGHT); 148 set_arrow(views::BubbleBorder::TOP_RIGHT);
149 } 149 }
150 150
151 void ImeWarningBubbleView::InitLayout() { 151 void ImeWarningBubbleView::InitLayout() {
152 // The Ime warning bubble is like this: 152 // The Ime warning bubble is like this:
153 // 153 //
154 // ----------------------------------------- 154 // -----------------------------------------
155 // | Warning info | 155 // | Warning info |
(...skipping 30 matching lines...) Expand all
186 layout->StartRow(0, cs_id); 186 layout->StartRow(0, cs_id);
187 never_show_checkbox_ = 187 never_show_checkbox_ =
188 new views::Checkbox(l10n_util::GetStringUTF16(IDS_IME_API_NEVER_SHOW)); 188 new views::Checkbox(l10n_util::GetStringUTF16(IDS_IME_API_NEVER_SHOW));
189 layout->AddView(never_show_checkbox_); 189 layout->AddView(never_show_checkbox_);
190 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 190 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
191 } 191 }
192 192
193 bool ImeWarningBubbleView::IsToolbarAnimating() { 193 bool ImeWarningBubbleView::IsToolbarAnimating() {
194 return anchor_to_browser_action_ && container_->animating(); 194 return anchor_to_browser_action_ && container_->animating();
195 } 195 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/views/keyboard_access_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698