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

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

Issue 6693054: Get rid of extensions dependency from content\browser. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 | Annotate | Revision Log
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_list.h" 8 #include "chrome/browser/browser_list.h"
9 #include "chrome/browser/extensions/extension_tab_helper.h"
9 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/tabs/tab_strip_model.h" 12 #include "chrome/browser/tabs/tab_strip_model.h"
12 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
14 #include "chrome/common/extensions/extension.h" 15 #include "chrome/common/extensions/extension.h"
15 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
16 #include "content/browser/tab_contents/tab_contents.h" 17 #include "content/browser/tab_contents/tab_contents.h"
17 #include "content/common/page_transition_types.h" 18 #include "content/common/page_transition_types.h"
18 19
(...skipping 17 matching lines...) Expand all
36 37
37 // Adds a DictionaryValue to |values| representing the pinned tab at the 38 // Adds a DictionaryValue to |values| representing the pinned tab at the
38 // specified index. 39 // specified index.
39 static void EncodePinnedTab(TabStripModel* model, 40 static void EncodePinnedTab(TabStripModel* model,
40 int index, 41 int index,
41 ListValue* values) { 42 ListValue* values) {
42 scoped_ptr<DictionaryValue> value(new DictionaryValue()); 43 scoped_ptr<DictionaryValue> value(new DictionaryValue());
43 44
44 TabContentsWrapper* tab_contents = model->GetTabContentsAt(index); 45 TabContentsWrapper* tab_contents = model->GetTabContentsAt(index);
45 if (model->IsAppTab(index)) { 46 if (model->IsAppTab(index)) {
46 const Extension* extension = tab_contents->extension_app(); 47 const Extension* extension =
48 tab_contents->extension_tab_helper()->extension_app();
47 DCHECK(extension); 49 DCHECK(extension);
48 value->SetString(kAppID, extension->id()); 50 value->SetString(kAppID, extension->id());
49 // For apps we use the launch url. We do this for the following reason: 51 // For apps we use the launch url. We do this for the following reason:
50 // . the user is effectively restarting the app, so that returning them to 52 // . the user is effectively restarting the app, so that returning them to
51 // the app's launch page seems closest to what they expect. 53 // the app's launch page seems closest to what they expect.
52 value->SetString(kURL, extension->GetFullLaunchURL().spec()); 54 value->SetString(kURL, extension->GetFullLaunchURL().spec());
53 values->Append(value.release()); 55 values->Append(value.release());
54 } else { 56 } else {
55 NavigationEntry* entry = tab_contents->controller().GetActiveEntry(); 57 NavigationEntry* entry = tab_contents->controller().GetActiveEntry();
56 if (!entry && tab_contents->controller().entry_count()) 58 if (!entry && tab_contents->controller().entry_count())
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 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) {
125 DictionaryValue* values = NULL; 127 DictionaryValue* values = NULL;
126 if (pref_value->GetDictionary(i, &values)) { 128 if (pref_value->GetDictionary(i, &values)) {
127 Tab tab; 129 Tab tab;
128 if (DecodeTab(*values, &tab)) 130 if (DecodeTab(*values, &tab))
129 results.push_back(tab); 131 results.push_back(tab);
130 } 132 }
131 } 133 }
132 return results; 134 return results;
133 } 135 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/background_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