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

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

Issue 1578293003: Fullscreen bubble: Now speaks the bubble text if a11y enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 6 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/subtle_notification_view.h" 5 #include "chrome/browser/ui/views/subtle_notification_view.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "third_party/skia/include/core/SkColor.h" 11 #include "third_party/skia/include/core/SkColor.h"
12 #include "ui/accessibility/ax_view_state.h"
12 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
13 #include "ui/gfx/font_list.h" 14 #include "ui/gfx/font_list.h"
14 #include "ui/views/bubble/bubble_border.h" 15 #include "ui/views/bubble/bubble_border.h"
15 #include "ui/views/controls/label.h" 16 #include "ui/views/controls/label.h"
16 #include "ui/views/controls/link.h" 17 #include "ui/views/controls/link.h"
17 #include "ui/views/layout/box_layout.h" 18 #include "ui/views/layout/box_layout.h"
18 #include "ui/views/widget/widget.h" 19 #include "ui/views/widget/widget.h"
19 20
20 namespace { 21 namespace {
21 22
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 178
178 void SubtleNotificationView::UpdateContent( 179 void SubtleNotificationView::UpdateContent(
179 const base::string16& instruction_text, 180 const base::string16& instruction_text,
180 const base::string16& link_text) { 181 const base::string16& link_text) {
181 instruction_view_->SetText(instruction_text); 182 instruction_view_->SetText(instruction_text);
182 instruction_view_->SetVisible(!instruction_text.empty()); 183 instruction_view_->SetVisible(!instruction_text.empty());
183 link_->SetText(link_text); 184 link_->SetText(link_text);
184 link_->SetVisible(!link_text.empty()); 185 link_->SetVisible(!link_text.empty());
185 } 186 }
186 187
188 void SubtleNotificationView::GetAccessibleState(ui::AXViewState* state) {
189 LOG(ERROR) << "SubtleNotificationView::GetAccessibleState";
190 state->role = ui::AX_ROLE_LABEL_TEXT;
191 state->name = base::ASCIIToUTF16("SubtleNotificationView (test)");
192 }
193
187 // static 194 // static
188 views::Widget* SubtleNotificationView::CreatePopupWidget( 195 views::Widget* SubtleNotificationView::CreatePopupWidget(
189 gfx::NativeView parent_view, 196 gfx::NativeView parent_view,
190 SubtleNotificationView* view, 197 SubtleNotificationView* view,
191 bool accept_events) { 198 bool accept_events) {
192 // Initialize the popup. 199 // Initialize the popup.
193 views::Widget* popup = new views::Widget; 200 views::Widget* popup = new views::Widget;
194 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); 201 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
195 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 202 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
196 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 203 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
197 params.parent = parent_view; 204 params.parent = parent_view;
198 params.accept_events = accept_events; 205 params.accept_events = accept_events;
199 popup->Init(params); 206 popup->Init(params);
200 popup->SetContentsView(view); 207 popup->SetContentsView(view);
201 // We set layout manager to nullptr to prevent the widget from sizing its 208 // We set layout manager to nullptr to prevent the widget from sizing its
202 // contents to the same size as itself. This prevents the widget contents from 209 // contents to the same size as itself. This prevents the widget contents from
203 // shrinking while we animate the height of the popup to give the impression 210 // shrinking while we animate the height of the popup to give the impression
204 // that it is sliding off the top of the screen. 211 // that it is sliding off the top of the screen.
205 // TODO(mgiuca): This probably isn't necessary now that there is no slide 212 // TODO(mgiuca): This probably isn't necessary now that there is no slide
206 // animation. Remove it. 213 // animation. Remove it.
207 popup->GetRootView()->SetLayoutManager(nullptr); 214 popup->GetRootView()->SetLayoutManager(nullptr);
208 215
209 return popup; 216 return popup;
210 } 217 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/subtle_notification_view.h ('k') | ui/views/accessibility/ax_view_obj_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698