Chromium Code Reviews| 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/tabs/pinned_tab_codec.h" | 5 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/prefs/scoped_user_pref_update.h" | 8 #include "base/prefs/scoped_user_pref_update.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/extensions/tab_helper.h" | 10 #include "chrome/browser/extensions/tab_helper.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 extensions::TabHelper::FromWebContents(web_contents)->extension_app(); | 60 extensions::TabHelper::FromWebContents(web_contents)->extension_app(); |
| 61 DCHECK(extension); | 61 DCHECK(extension); |
| 62 value->SetString(kAppID, extension->id()); | 62 value->SetString(kAppID, extension->id()); |
| 63 // For apps we use the launch url. We do this because the user is | 63 // For apps we use the launch url. We do this because the user is |
| 64 // effectively restarting the app, so returning them to the app's launch | 64 // effectively restarting the app, so returning them to the app's launch |
| 65 // page seems closest to what they expect. | 65 // page seems closest to what they expect. |
| 66 value->SetString( | 66 value->SetString( |
| 67 kURL, extensions::AppLaunchInfo::GetFullLaunchURL(extension).spec()); | 67 kURL, extensions::AppLaunchInfo::GetFullLaunchURL(extension).spec()); |
| 68 values->Append(value.release()); | 68 values->Append(value.release()); |
| 69 } else { | 69 } else { |
| 70 NavigationEntry* entry = web_contents->GetController().GetActiveEntry(); | 70 NavigationEntry* entry = web_contents->GetController().GetVisibleEntry(); |
|
nasko
2013/11/08 23:52:03
Why not LastCommitted here?
jww
2013/11/11 19:18:51
In this case, my thinking was that a user is tryin
| |
| 71 if (!entry && web_contents->GetController().GetEntryCount()) | 71 if (!entry && web_contents->GetController().GetEntryCount()) |
| 72 entry = web_contents->GetController().GetEntryAtIndex(0); | 72 entry = web_contents->GetController().GetEntryAtIndex(0); |
| 73 if (entry) { | 73 if (entry) { |
| 74 value->SetString(kURL, entry->GetURL().spec()); | 74 value->SetString(kURL, entry->GetURL().spec()); |
| 75 values->Append(value.release()); | 75 values->Append(value.release()); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 // Invokes EncodePinnedTab for each pinned tab in browser. | 80 // Invokes EncodePinnedTab for each pinned tab in browser. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 for (size_t i = 0, max = tabs_list->GetSize(); i < max; ++i) { | 157 for (size_t i = 0, max = tabs_list->GetSize(); i < max; ++i) { |
| 158 const base::DictionaryValue* tab_values = NULL; | 158 const base::DictionaryValue* tab_values = NULL; |
| 159 if (tabs_list->GetDictionary(i, &tab_values)) { | 159 if (tabs_list->GetDictionary(i, &tab_values)) { |
| 160 StartupTab tab; | 160 StartupTab tab; |
| 161 if (DecodeTab(*tab_values, &tab)) | 161 if (DecodeTab(*tab_values, &tab)) |
| 162 results.push_back(tab); | 162 results.push_back(tab); |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 return results; | 165 return results; |
| 166 } | 166 } |
| OLD | NEW |