OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 5449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5460 | 5460 |
5461 void Browser::ToggleSpeechInput() { | 5461 void Browser::ToggleSpeechInput() { |
5462 GetSelectedTabContentsWrapper()->render_view_host()->ToggleSpeechInput(); | 5462 GetSelectedTabContentsWrapper()->render_view_host()->ToggleSpeechInput(); |
5463 } | 5463 } |
5464 | 5464 |
5465 void Browser::OnWindowDidShow() { | 5465 void Browser::OnWindowDidShow() { |
5466 if (window_has_shown_) | 5466 if (window_has_shown_) |
5467 return; | 5467 return; |
5468 window_has_shown_ = true; | 5468 window_has_shown_ = true; |
5469 | 5469 |
| 5470 // Nothing to do for non-tabbed windows. |
| 5471 if (!is_type_tabbed()) |
| 5472 return; |
| 5473 |
5470 // Suppress the first run bubble if we're showing the sync promo. | 5474 // Suppress the first run bubble if we're showing the sync promo. |
5471 TabContents* contents = GetSelectedTabContents(); | 5475 TabContents* contents = GetSelectedTabContents(); |
5472 bool is_showing_promo = contents && | 5476 bool is_showing_promo = contents && |
5473 contents->GetURL().SchemeIs(chrome::kChromeUIScheme) && | 5477 contents->GetURL().SchemeIs(chrome::kChromeUIScheme) && |
5474 contents->GetURL().host() == chrome::kChromeUISyncPromoHost; | 5478 contents->GetURL().host() == chrome::kChromeUISyncPromoHost; |
5475 | 5479 |
5476 // Show the First Run information bubble if we've been told to. | 5480 // Show the First Run information bubble if we've been told to. |
5477 PrefService* local_state = g_browser_process->local_state(); | 5481 PrefService* local_state = g_browser_process->local_state(); |
5478 if (!is_showing_promo && local_state && | 5482 if (!is_showing_promo && local_state && |
5479 local_state->GetBoolean(prefs::kShouldShowFirstRunBubble)) { | 5483 local_state->GetBoolean(prefs::kShouldShowFirstRunBubble)) { |
5480 FirstRun::BubbleType bubble_type = FirstRun::MINIMAL_BUBBLE; | 5484 FirstRun::BubbleType bubble_type = FirstRun::MINIMAL_BUBBLE; |
5481 if (local_state-> | 5485 if (local_state-> |
5482 FindPreference(prefs::kShouldUseOEMFirstRunBubble) && | 5486 FindPreference(prefs::kShouldUseOEMFirstRunBubble) && |
5483 local_state->GetBoolean(prefs::kShouldUseOEMFirstRunBubble)) { | 5487 local_state->GetBoolean(prefs::kShouldUseOEMFirstRunBubble)) { |
5484 bubble_type = FirstRun::OEM_BUBBLE; | 5488 bubble_type = FirstRun::OEM_BUBBLE; |
5485 } else if (local_state-> | 5489 } else if (local_state-> |
5486 FindPreference(prefs::kShouldUseMinimalFirstRunBubble) && | 5490 FindPreference(prefs::kShouldUseMinimalFirstRunBubble) && |
5487 local_state->GetBoolean(prefs::kShouldUseMinimalFirstRunBubble)) { | 5491 local_state->GetBoolean(prefs::kShouldUseMinimalFirstRunBubble)) { |
5488 bubble_type = FirstRun::MINIMAL_BUBBLE; | 5492 bubble_type = FirstRun::MINIMAL_BUBBLE; |
5489 } | 5493 } |
5490 // Reset the preference so we don't show the bubble for subsequent | 5494 // Reset the preference so we don't show the bubble for subsequent |
5491 // windows. | 5495 // windows. |
5492 local_state->SetBoolean(prefs::kShouldShowFirstRunBubble, false); | 5496 local_state->SetBoolean(prefs::kShouldShowFirstRunBubble, false); |
5493 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); | 5497 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); |
5494 } else if (is_type_tabbed()) { | 5498 } else { |
5495 GlobalErrorService* service = | 5499 GlobalErrorService* service = |
5496 GlobalErrorServiceFactory::GetForProfile(profile()); | 5500 GlobalErrorServiceFactory::GetForProfile(profile()); |
5497 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 5501 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
5498 if (error) { | 5502 if (error) { |
5499 error->ShowBubbleView(this); | 5503 error->ShowBubbleView(this); |
5500 } | 5504 } |
5501 } | 5505 } |
5502 } | 5506 } |
5503 | 5507 |
5504 FullscreenExitBubbleType Browser::GetFullscreenExitBubbleType() const { | 5508 FullscreenExitBubbleType Browser::GetFullscreenExitBubbleType() const { |
(...skipping 16 matching lines...) Expand all Loading... |
5521 } | 5525 } |
5522 | 5526 |
5523 void Browser::UpdateFullscreenExitBubbleContent() { | 5527 void Browser::UpdateFullscreenExitBubbleContent() { |
5524 GURL url; | 5528 GURL url; |
5525 if (fullscreened_tab_) | 5529 if (fullscreened_tab_) |
5526 url = fullscreened_tab_->tab_contents()->GetURL(); | 5530 url = fullscreened_tab_->tab_contents()->GetURL(); |
5527 | 5531 |
5528 window_->UpdateFullscreenExitBubbleContent( | 5532 window_->UpdateFullscreenExitBubbleContent( |
5529 url, GetFullscreenExitBubbleType()); | 5533 url, GetFullscreenExitBubbleType()); |
5530 } | 5534 } |
OLD | NEW |