Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: chrome/browser/tabs/pinned_tab_codec.cc

Issue 2821011: Removes phantom tabs. (Closed)
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.cc ('k') | chrome/browser/tabs/tab_strip_model.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/tabs/pinned_tab_codec.h" 5 #include "chrome/browser/tabs/pinned_tab_codec.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/browser.h" 8 #include "chrome/browser/browser.h"
9 #include "chrome/browser/browser_list.h" 9 #include "chrome/browser/browser_list.h"
10 #include "chrome/browser/pref_service.h" 10 #include "chrome/browser/pref_service.h"
(...skipping 28 matching lines...) Expand all
39 static void EncodePinnedTab(TabStripModel* model, 39 static void EncodePinnedTab(TabStripModel* model,
40 int index, 40 int index,
41 ListValue* values) { 41 ListValue* values) {
42 scoped_ptr<DictionaryValue> value(new DictionaryValue()); 42 scoped_ptr<DictionaryValue> value(new DictionaryValue());
43 43
44 TabContents* tab_contents = model->GetTabContentsAt(index); 44 TabContents* tab_contents = model->GetTabContentsAt(index);
45 if (model->IsAppTab(index)) { 45 if (model->IsAppTab(index)) {
46 Extension* extension = tab_contents->extension_app(); 46 Extension* extension = tab_contents->extension_app();
47 DCHECK(extension); 47 DCHECK(extension);
48 value->SetString(kAppID, extension->id()); 48 value->SetString(kAppID, extension->id());
49 // For apps we use the launch url. We do this for two reasons: 49 // For apps we use the launch url. We do this as the user is effectively
50 // . the user is effectively restarting the app, so that returning them to 50 // restarting the app, so that returning them to the app's launch page seems
51 // the app's launch page seems closest to what they expect. 51 // closest to what they expect.
52 // . we do the same when restoring a phantom tab.
53 value->SetString(kURL, extension->GetFullLaunchURL().spec()); 52 value->SetString(kURL, extension->GetFullLaunchURL().spec());
54 values->Append(value.release()); 53 values->Append(value.release());
55 } else { 54 } else {
56 NavigationEntry* entry = tab_contents->controller().GetActiveEntry(); 55 NavigationEntry* entry = tab_contents->controller().GetActiveEntry();
57 if (!entry && tab_contents->controller().entry_count()) 56 if (!entry && tab_contents->controller().entry_count())
58 entry = tab_contents->controller().GetEntryAtIndex(0); 57 entry = tab_contents->controller().GetEntryAtIndex(0);
59 if (entry) { 58 if (entry) {
60 value->SetString(kURL, entry->url().spec()); 59 value->SetString(kURL, entry->url().spec());
61 values->Append(value.release()); 60 values->Append(value.release());
62 } 61 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 for (size_t i = 0, max = pref_value->GetSize(); i < max; ++i) { 124 for (size_t i = 0, max = pref_value->GetSize(); i < max; ++i) {
126 DictionaryValue* values = NULL; 125 DictionaryValue* values = NULL;
127 if (pref_value->GetDictionary(i, &values)) { 126 if (pref_value->GetDictionary(i, &values)) {
128 Tab tab; 127 Tab tab;
129 if (DecodeTab(*values, &tab)) 128 if (DecodeTab(*values, &tab))
130 results.push_back(tab); 129 results.push_back(tab);
131 } 130 }
132 } 131 }
133 return results; 132 return results;
134 } 133 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.cc ('k') | chrome/browser/tabs/tab_strip_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698