| 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.h" | 5 #include "chrome/browser/ui/android/tab_model/tab_model.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // remove our pointer to the profile accordingly. | 34 // remove our pointer to the profile accordingly. |
| 35 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, | 35 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
| 36 content::Source<Profile>(profile_)); | 36 content::Source<Profile>(profile_)); |
| 37 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED, | 37 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED, |
| 38 content::NotificationService::AllSources()); | 38 content::NotificationService::AllSources()); |
| 39 } else { | 39 } else { |
| 40 is_off_the_record_ = false; | 40 is_off_the_record_ = false; |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 TabModel::TabModel() | |
| 45 : profile_(NULL), | |
| 46 is_off_the_record_(false), | |
| 47 synced_window_delegate_( | |
| 48 new browser_sync::SyncedWindowDelegateAndroid(this)) { | |
| 49 } | |
| 50 | |
| 51 TabModel::~TabModel() { | 44 TabModel::~TabModel() { |
| 52 } | 45 } |
| 53 | 46 |
| 54 content::WebContents* TabModel::GetActiveWebContents() const { | 47 content::WebContents* TabModel::GetActiveWebContents() const { |
| 55 if (GetTabCount() == 0 || GetActiveIndex() < 0 || | 48 if (GetTabCount() == 0 || GetActiveIndex() < 0 || |
| 56 GetActiveIndex() > GetTabCount()) | 49 GetActiveIndex() > GetTabCount()) |
| 57 return NULL; | 50 return NULL; |
| 58 return GetWebContentsAt(GetActiveIndex()); | 51 return GetWebContentsAt(GetActiveIndex()); |
| 59 } | 52 } |
| 60 | 53 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 if (is_off_the_record_) { | 120 if (is_off_the_record_) { |
| 128 Profile* profile = content::Source<Profile>(source).ptr(); | 121 Profile* profile = content::Source<Profile>(source).ptr(); |
| 129 if (profile && profile->IsOffTheRecord()) | 122 if (profile && profile->IsOffTheRecord()) |
| 130 profile_ = profile; | 123 profile_ = profile; |
| 131 } | 124 } |
| 132 break; | 125 break; |
| 133 default: | 126 default: |
| 134 NOTREACHED(); | 127 NOTREACHED(); |
| 135 } | 128 } |
| 136 } | 129 } |
| OLD | NEW |