| 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/google/google_url_tracker.h" | 5 #include "chrome/browser/google/google_url_tracker.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/google/google_util.h" | 14 #include "chrome/browser/google/google_util.h" |
| 15 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 15 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
| 16 #include "chrome/browser/search_engines/template_url.h" | 17 #include "chrome/browser/search_engines/template_url.h" |
| 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 18 #include "chrome/common/chrome_notification_types.h" | 19 #include "chrome/common/chrome_notification_types.h" |
| 19 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 21 #include "content/browser/tab_contents/navigation_controller.h" | 22 #include "content/browser/tab_contents/navigation_controller.h" |
| 22 #include "content/common/notification_service.h" | 23 #include "content/common/notification_service.h" |
| 23 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 24 #include "net/base/load_flags.h" | 25 #include "net/base/load_flags.h" |
| 25 #include "net/base/net_util.h" | 26 #include "net/base/net_util.h" |
| 26 #include "net/url_request/url_request_context_getter.h" | 27 #include "net/url_request/url_request_context_getter.h" |
| 27 #include "net/url_request/url_request_status.h" | 28 #include "net/url_request/url_request_status.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 29 | 30 |
| 30 namespace { | 31 namespace { |
| 31 | 32 |
| 32 InfoBarDelegate* CreateInfobar(TabContents* tab_contents, | 33 InfoBarDelegate* CreateInfobar(TabContents* tab_contents, |
| 33 GoogleURLTracker* google_url_tracker, | 34 GoogleURLTracker* google_url_tracker, |
| 34 const GURL& new_google_url) { | 35 const GURL& new_google_url) { |
| 35 InfoBarDelegate* infobar = new GoogleURLTrackerInfoBarDelegate(tab_contents, | 36 InfoBarDelegate* infobar = new GoogleURLTrackerInfoBarDelegate(tab_contents, |
| 36 google_url_tracker, new_google_url); | 37 google_url_tracker, new_google_url); |
| 37 TabContentsWrapper* wrapper = | 38 TabContentsWrapper* wrapper = |
| 38 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); | 39 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); |
| 39 wrapper->AddInfoBar(infobar); | 40 wrapper->infobar_tab_helper()->AddInfoBar(infobar); |
| 40 return infobar; | 41 return infobar; |
| 41 } | 42 } |
| 42 | 43 |
| 43 } // namespace | 44 } // namespace |
| 44 | 45 |
| 45 // GoogleURLTrackerInfoBarDelegate -------------------------------------------- | 46 // GoogleURLTrackerInfoBarDelegate -------------------------------------------- |
| 46 | 47 |
| 47 GoogleURLTrackerInfoBarDelegate::GoogleURLTrackerInfoBarDelegate( | 48 GoogleURLTrackerInfoBarDelegate::GoogleURLTrackerInfoBarDelegate( |
| 48 TabContents* tab_contents, | 49 TabContents* tab_contents, |
| 49 GoogleURLTracker* google_url_tracker, | 50 GoogleURLTracker* google_url_tracker, |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 } | 377 } |
| 377 | 378 |
| 378 void GoogleURLTracker::ShowGoogleURLInfoBarIfNecessary( | 379 void GoogleURLTracker::ShowGoogleURLInfoBarIfNecessary( |
| 379 TabContents* tab_contents) { | 380 TabContents* tab_contents) { |
| 380 if (!need_to_prompt_) | 381 if (!need_to_prompt_) |
| 381 return; | 382 return; |
| 382 DCHECK(!fetched_google_url_.is_empty()); | 383 DCHECK(!fetched_google_url_.is_empty()); |
| 383 | 384 |
| 384 infobar_ = (*infobar_creator_)(tab_contents, this, fetched_google_url_); | 385 infobar_ = (*infobar_creator_)(tab_contents, this, fetched_google_url_); |
| 385 } | 386 } |
| OLD | NEW |