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

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

Issue 286733002: [Refactor] Consolidate the logic for whether a widget can be activated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/screen_capture_notification_ui.h" 5 #include "chrome/browser/ui/screen_capture_notification_ui.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "chrome/app/chrome_dll_resource.h" 8 #include "chrome/app/chrome_dll_resource.h"
9 #include "chrome/browser/ui/views/chrome_views_export.h" 9 #include "chrome/browser/ui/views/chrome_views_export.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 gfx::NativeViewId ScreenCaptureNotificationUIViews::OnStarted( 163 gfx::NativeViewId ScreenCaptureNotificationUIViews::OnStarted(
164 const base::Closure& stop_callback) { 164 const base::Closure& stop_callback) {
165 stop_callback_ = stop_callback; 165 stop_callback_ = stop_callback;
166 166
167 label_->SetElideBehavior(views::Label::ELIDE_IN_MIDDLE); 167 label_->SetElideBehavior(views::Label::ELIDE_IN_MIDDLE);
168 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 168 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
169 label_->SetText(text_); 169 label_->SetText(text_);
170 170
171 views::Widget* widget = new views::Widget; 171 views::Widget* widget = new views::Widget;
172 172
173 views::Widget::InitParams params; 173 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
174 params.delegate = this; 174 params.delegate = this;
175 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 175 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
176 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 176 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
177 params.remove_standard_frame = true; 177 params.remove_standard_frame = true;
178 params.keep_on_top = true; 178 params.keep_on_top = true;
179 params.top_level = true; 179 params.top_level = true;
180 // Make sure can_activate is true so the window icon will show in the taskbar.
181 params.can_activate = true;
182 180
183 #if defined(USE_ASH) 181 #if defined(USE_ASH)
184 // TODO(sergeyu): The notification bar must be shown on the monitor that's 182 // TODO(sergeyu): The notification bar must be shown on the monitor that's
185 // being captured. Make sure it's always the case. Currently we always capture 183 // being captured. Make sure it's always the case. Currently we always capture
186 // the primary monitor. 184 // the primary monitor.
187 if (ash::Shell::HasInstance()) 185 if (ash::Shell::HasInstance())
188 params.context = ash::Shell::GetPrimaryRootWindow(); 186 params.context = ash::Shell::GetPrimaryRootWindow();
189 #endif 187 #endif
190 188
191 widget->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM); 189 widget->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 } 328 }
331 } 329 }
332 330
333 } // namespace 331 } // namespace
334 332
335 scoped_ptr<ScreenCaptureNotificationUI> ScreenCaptureNotificationUI::Create( 333 scoped_ptr<ScreenCaptureNotificationUI> ScreenCaptureNotificationUI::Create(
336 const base::string16& text) { 334 const base::string16& text) {
337 return scoped_ptr<ScreenCaptureNotificationUI>( 335 return scoped_ptr<ScreenCaptureNotificationUI>(
338 new ScreenCaptureNotificationUIViews(text)); 336 new ScreenCaptureNotificationUIViews(text));
339 } 337 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc ('k') | chrome/browser/ui/views/tabs/tab_strip.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698