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

Side by Side Diff: chrome/browser/sidebar/sidebar_manager.cc

Issue 6321006: Add "sidebar" section to extension manifest:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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/sidebar/sidebar_manager.h" 5 #include "chrome/browser/sidebar/sidebar_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 } 103 }
104 104
105 void SidebarManager::ShowSidebar(TabContents* tab, 105 void SidebarManager::ShowSidebar(TabContents* tab,
106 const std::string& content_id) { 106 const std::string& content_id) {
107 DCHECK(!content_id.empty()); 107 DCHECK(!content_id.empty());
108 SidebarContainer* host = GetSidebarContainerFor(tab, content_id); 108 SidebarContainer* host = GetSidebarContainerFor(tab, content_id);
109 if (!host) { 109 if (!host) {
110 host = new SidebarContainer(tab, content_id, this); 110 host = new SidebarContainer(tab, content_id, this);
111 RegisterSidebarContainerFor(tab, host); 111 RegisterSidebarContainerFor(tab, host);
112 // It might trigger UpdateSidebar notification, so load them after
113 // the registration.
114 host->LoadDefaults();
112 } 115 }
113 116
114 host->Show(); 117 host->Show();
115 118
116 ExtensionSidebarEventRouter::OnStateChanged( 119 ExtensionSidebarEventRouter::OnStateChanged(
117 tab->profile(), tab, content_id, 120 tab->profile(), tab, content_id,
118 extension_sidebar_constants::kShownState); 121 extension_sidebar_constants::kShownState);
119 } 122 }
120 123
121 void SidebarManager::ExpandSidebar(TabContents* tab, 124 void SidebarManager::ExpandSidebar(TabContents* tab,
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 323
321 DCHECK(GetSidebarContainerFor(tab, content_id) == sidebar_host); 324 DCHECK(GetSidebarContainerFor(tab, content_id) == sidebar_host);
322 DCHECK(sidebar_host_to_tab_.find(sidebar_host)->second == tab); 325 DCHECK(sidebar_host_to_tab_.find(sidebar_host)->second == tab);
323 DCHECK(tab_to_sidebar_host_[tab].active_content_id != content_id); 326 DCHECK(tab_to_sidebar_host_[tab].active_content_id != content_id);
324 327
325 tab_to_sidebar_host_[tab].content_id_to_sidebar_host.erase(content_id); 328 tab_to_sidebar_host_[tab].content_id_to_sidebar_host.erase(content_id);
326 if (tab_to_sidebar_host_[tab].content_id_to_sidebar_host.empty()) 329 if (tab_to_sidebar_host_[tab].content_id_to_sidebar_host.empty())
327 tab_to_sidebar_host_.erase(tab); 330 tab_to_sidebar_host_.erase(tab);
328 sidebar_host_to_tab_.erase(sidebar_host); 331 sidebar_host_to_tab_.erase(sidebar_host);
329 } 332 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698