| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/first_run_bubble.h" | 5 #include "chrome/browser/views/first_run_bubble.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/win_util.h" | 9 #include "base/win_util.h" |
| 10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 if (::IsWindowEnabled(GetParent())) | 336 if (::IsWindowEnabled(GetParent())) |
| 337 InfoBubble::OnActivate(action, minimized, window); | 337 InfoBubble::OnActivate(action, minimized, window); |
| 338 } | 338 } |
| 339 | 339 |
| 340 void FirstRunBubble::InfoBubbleClosing(InfoBubble* info_bubble, | 340 void FirstRunBubble::InfoBubbleClosing(InfoBubble* info_bubble, |
| 341 bool closed_by_escape) { | 341 bool closed_by_escape) { |
| 342 // Make sure our parent window is re-enabled. | 342 // Make sure our parent window is re-enabled. |
| 343 if (!IsWindowEnabled(GetParent())) | 343 if (!IsWindowEnabled(GetParent())) |
| 344 ::EnableWindow(GetParent(), true); | 344 ::EnableWindow(GetParent(), true); |
| 345 enable_window_method_factory_.RevokeAll(); | 345 enable_window_method_factory_.RevokeAll(); |
| 346 views::FocusManager* focus_manager = | 346 GetFocusManager()->RemoveFocusChangeListener(view_); |
| 347 views::FocusManager::GetFocusManager(GetNativeView()); | |
| 348 focus_manager->RemoveFocusChangeListener(view_); | |
| 349 } | 347 } |
| 350 | 348 |
| 351 // static | 349 // static |
| 352 FirstRunBubble* FirstRunBubble::Show(Profile* profile, views::Window* parent, | 350 FirstRunBubble* FirstRunBubble::Show(Profile* profile, views::Window* parent, |
| 353 const gfx::Rect& position_relative_to, | 351 const gfx::Rect& position_relative_to, |
| 354 bool use_OEM_bubble) { | 352 bool use_OEM_bubble) { |
| 355 FirstRunBubble* window = new FirstRunBubble(); | 353 FirstRunBubble* window = new FirstRunBubble(); |
| 356 FirstRunBubbleViewBase* view = NULL; | 354 FirstRunBubbleViewBase* view = NULL; |
| 357 if (use_OEM_bubble) | 355 if (use_OEM_bubble) |
| 358 view = new FirstRunOEMBubbleView(window, profile); | 356 view = new FirstRunOEMBubbleView(window, profile); |
| 359 else | 357 else |
| 360 view = new FirstRunBubbleView(window, profile); | 358 view = new FirstRunBubbleView(window, profile); |
| 361 window->SetDelegate(window); | 359 window->SetDelegate(window); |
| 362 window->set_view(view); | 360 window->set_view(view); |
| 363 window->Init(parent, position_relative_to, view); | 361 window->Init(parent, position_relative_to, view); |
| 364 window->ShowWindow(SW_SHOW); | 362 window->ShowWindow(SW_SHOW); |
| 365 views::FocusManager* focus_manager = | 363 window->GetFocusManager()->AddFocusChangeListener(view); |
| 366 views::FocusManager::GetFocusManager(window->GetNativeView()); | |
| 367 focus_manager->AddFocusChangeListener(view); | |
| 368 view->BubbleShown(); | 364 view->BubbleShown(); |
| 369 return window; | 365 return window; |
| 370 } | 366 } |
| 371 | 367 |
| 372 void FirstRunBubble::EnableParent() { | 368 void FirstRunBubble::EnableParent() { |
| 373 ::EnableWindow(GetParent(), true); | 369 ::EnableWindow(GetParent(), true); |
| 374 // Reactivate the FirstRunBubble so it responds to OnActivate messages. | 370 // Reactivate the FirstRunBubble so it responds to OnActivate messages. |
| 375 SetWindowPos(GetParent(), 0, 0, 0, 0, | 371 SetWindowPos(GetParent(), 0, 0, 0, 0, |
| 376 SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_SHOWWINDOW); | 372 SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_SHOWWINDOW); |
| 377 } | 373 } |
| OLD | NEW |