OLD | NEW |
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/chromeos/status/data_promo_notification.h" | 5 #include "chrome/browser/chromeos/status/data_promo_notification.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 carrier_deal_promo_pref = GetCarrierDealPromoShown(); | 153 carrier_deal_promo_pref = GetCarrierDealPromoShown(); |
154 const std::string locale = g_browser_process->GetApplicationLocale(); | 154 const std::string locale = g_browser_process->GetApplicationLocale(); |
155 deal_text = deal->GetLocalizedString(locale, "notification_text"); | 155 deal_text = deal->GetLocalizedString(locale, "notification_text"); |
156 deal_info_url_ = deal->info_url(); | 156 deal_info_url_ = deal->info_url(); |
157 deal_topup_url_ = carrier->top_up_url(); | 157 deal_topup_url_ = carrier->top_up_url(); |
158 } else if (!ShouldShow3gPromoNotification()) { | 158 } else if (!ShouldShow3gPromoNotification()) { |
159 check_for_promo_ = false; | 159 check_for_promo_ = false; |
160 return; | 160 return; |
161 } | 161 } |
162 | 162 |
163 gfx::Rect button_bounds = host->GetScreenBounds(); | 163 gfx::Rect button_bounds = host->GetBoundsInScreen(); |
164 // StatusArea button Y position is usually -1, fix it so that | 164 // StatusArea button Y position is usually -1, fix it so that |
165 // Contains() method for screen bounds works correctly. | 165 // Contains() method for screen bounds works correctly. |
166 button_bounds.set_y(button_bounds.y() + 1); | 166 button_bounds.set_y(button_bounds.y() + 1); |
167 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); | 167 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); |
168 | 168 |
169 // Chrome window is initialized in visible state off screen and then is | 169 // Chrome window is initialized in visible state off screen and then is |
170 // moved into visible screen area. Make sure that we're on screen | 170 // moved into visible screen area. Make sure that we're on screen |
171 // so that bubble is shown correctly. | 171 // so that bubble is shown correctly. |
172 if (!screen_bounds.Contains(button_bounds)) { | 172 if (!screen_bounds.Contains(button_bounds)) { |
173 // If we're not on screen yet, delay notification display. | 173 // If we're not on screen yet, delay notification display. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 void DataPromoNotification::OnWidgetClosing(views::Widget* widget) { | 231 void DataPromoNotification::OnWidgetClosing(views::Widget* widget) { |
232 if (!mobile_data_bubble_ || mobile_data_bubble_->GetWidget() != widget) | 232 if (!mobile_data_bubble_ || mobile_data_bubble_->GetWidget() != widget) |
233 return; | 233 return; |
234 | 234 |
235 mobile_data_bubble_ = NULL; | 235 mobile_data_bubble_ = NULL; |
236 deal_info_url_.clear(); | 236 deal_info_url_.clear(); |
237 deal_topup_url_.clear(); | 237 deal_topup_url_.clear(); |
238 } | 238 } |
239 | 239 |
240 } // namespace chromeos | 240 } // namespace chromeos |
OLD | NEW |