| 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/ui/android/tab_model/tab_model_list.h" | 5 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" |
| 6 | 6 |
| 7 #include "chrome/browser/android/tab_android.h" | 7 #include "chrome/browser/android/tab_android.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/android/tab_model/tab_model.h" | 9 #include "chrome/browser/ui/android/tab_model/tab_model.h" |
| 10 #include "chrome/browser/ui/browser_navigator_params.h" | 10 #include "chrome/browser/ui/browser_navigator_params.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 void TabModelList::HandlePopupNavigation(chrome::NavigateParams* params) { | 38 void TabModelList::HandlePopupNavigation(chrome::NavigateParams* params) { |
| 39 TabAndroid* tab = TabAndroid::FromWebContents(params->source_contents); | 39 TabAndroid* tab = TabAndroid::FromWebContents(params->source_contents); |
| 40 | 40 |
| 41 // NOTE: If this fails contact dtrainor@. | 41 // NOTE: If this fails contact dtrainor@. |
| 42 DCHECK(tab); | 42 DCHECK(tab); |
| 43 tab->HandlePopupNavigation(params); | 43 tab->HandlePopupNavigation(params); |
| 44 } | 44 } |
| 45 | 45 |
| 46 TabModel* TabModelList::GetTabModelForWebContents( | 46 TabModel* TabModelList::GetTabModelForWebContents( |
| 47 content::WebContents* web_contents) { | 47 const content::WebContents* web_contents) { |
| 48 if (!web_contents) | 48 if (!web_contents) |
| 49 return NULL; | 49 return NULL; |
| 50 | 50 |
| 51 for (TabModelList::const_iterator i = TabModelList::begin(); | 51 for (TabModelList::const_iterator i = TabModelList::begin(); |
| 52 i != TabModelList::end(); ++i) { | 52 i != TabModelList::end(); ++i) { |
| 53 TabModel* model = *i; | 53 TabModel* model = *i; |
| 54 for (int index = 0; index < model->GetTabCount(); index++) { | 54 for (int index = 0; index < model->GetTabCount(); index++) { |
| 55 if (web_contents == model->GetWebContentsAt(index)) | 55 if (web_contents == model->GetWebContentsAt(index)) |
| 56 return model; | 56 return model; |
| 57 } | 57 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 94 } |
| 95 | 95 |
| 96 size_t TabModelList::size() { | 96 size_t TabModelList::size() { |
| 97 return tab_models().size(); | 97 return tab_models().size(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 TabModel* TabModelList::get(size_t index) { | 100 TabModel* TabModelList::get(size_t index) { |
| 101 DCHECK_LT(index, size()); | 101 DCHECK_LT(index, size()); |
| 102 return tab_models()[index]; | 102 return tab_models()[index]; |
| 103 } | 103 } |
| OLD | NEW |