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

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

Issue 8892011: Clean up TCW, make it solely a hub for 1:1 observer/helper objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | Annotate | Revision Log
OLDNEW
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/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/extensions/extension_tab_helper.h" 8 #include "chrome/browser/extensions/extension_tab_helper.h"
9 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 const Extension* extension = 46 const Extension* extension =
47 tab_contents->extension_tab_helper()->extension_app(); 47 tab_contents->extension_tab_helper()->extension_app();
48 DCHECK(extension); 48 DCHECK(extension);
49 value->SetString(kAppID, extension->id()); 49 value->SetString(kAppID, extension->id());
50 // For apps we use the launch url. We do this for the following reason: 50 // For apps we use the launch url. We do this for the following reason:
51 // . the user is effectively restarting the app, so that returning them to 51 // . the user is effectively restarting the app, so that returning them to
52 // the app's launch page seems closest to what they expect. 52 // the app's launch page seems closest to what they expect.
53 value->SetString(kURL, extension->GetFullLaunchURL().spec()); 53 value->SetString(kURL, extension->GetFullLaunchURL().spec());
54 values->Append(value.release()); 54 values->Append(value.release());
55 } else { 55 } else {
56 NavigationEntry* entry = tab_contents->controller().GetActiveEntry(); 56 NavigationEntry* entry =
57 if (!entry && tab_contents->controller().entry_count()) 57 tab_contents->tab_contents()->controller().GetActiveEntry();
58 entry = tab_contents->controller().GetEntryAtIndex(0); 58 if (!entry && tab_contents->tab_contents()->controller().entry_count())
59 entry = tab_contents->tab_contents()->controller().GetEntryAtIndex(0);
59 if (entry) { 60 if (entry) {
60 value->SetString(kURL, entry->url().spec()); 61 value->SetString(kURL, entry->url().spec());
61 values->Append(value.release()); 62 values->Append(value.release());
62 } 63 }
63 } 64 }
64 } 65 }
65 66
66 // Invokes EncodePinnedTab for each pinned tab in browser. 67 // Invokes EncodePinnedTab for each pinned tab in browser.
67 static void EncodePinnedTabs(Browser* browser, ListValue* values) { 68 static void EncodePinnedTabs(Browser* browser, ListValue* values) {
68 TabStripModel* tab_model = browser->tabstrip_model(); 69 TabStripModel* tab_model = browser->tabstrip_model();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 for (size_t i = 0, max = pref_value->GetSize(); i < max; ++i) { 126 for (size_t i = 0, max = pref_value->GetSize(); i < max; ++i) {
126 DictionaryValue* values = NULL; 127 DictionaryValue* values = NULL;
127 if (pref_value->GetDictionary(i, &values)) { 128 if (pref_value->GetDictionary(i, &values)) {
128 Tab tab; 129 Tab tab;
129 if (DecodeTab(*values, &tab)) 130 if (DecodeTab(*values, &tab))
130 results.push_back(tab); 131 results.push_back(tab);
131 } 132 }
132 } 133 }
133 return results; 134 return results;
134 } 135 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/web_drag_bookmark_handler_mac.mm ('k') | chrome/browser/tabs/tab_strip_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698