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

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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 } 101 }
102 102
103 void SidebarManager::ShowSidebar(TabContents* tab, 103 void SidebarManager::ShowSidebar(TabContents* tab,
104 const std::string& content_id) { 104 const std::string& content_id) {
105 DCHECK(!content_id.empty()); 105 DCHECK(!content_id.empty());
106 SidebarContainer* host = GetSidebarContainerFor(tab, content_id); 106 SidebarContainer* host = GetSidebarContainerFor(tab, content_id);
107 if (!host) { 107 if (!host) {
108 host = new SidebarContainer(tab, content_id, this); 108 host = new SidebarContainer(tab, content_id, this);
109 RegisterSidebarContainerFor(tab, host); 109 RegisterSidebarContainerFor(tab, host);
110 // It might trigger UpdateSidebar notification, so load them after
111 // the registration.
112 host->LoadDefaults();
110 } 113 }
111 114
112 host->Show(); 115 host->Show();
113 116
114 ExtensionSidebarEventRouter::OnStateChanged( 117 ExtensionSidebarEventRouter::OnStateChanged(
115 tab->profile(), tab, content_id, 118 tab->profile(), tab, content_id,
116 extension_sidebar_constants::kShownState); 119 extension_sidebar_constants::kShownState);
117 } 120 }
118 121
119 void SidebarManager::ExpandSidebar(TabContents* tab, 122 void SidebarManager::ExpandSidebar(TabContents* tab,
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 321
319 DCHECK(GetSidebarContainerFor(tab, content_id) == sidebar_host); 322 DCHECK(GetSidebarContainerFor(tab, content_id) == sidebar_host);
320 DCHECK(sidebar_host_to_tab_.find(sidebar_host)->second == tab); 323 DCHECK(sidebar_host_to_tab_.find(sidebar_host)->second == tab);
321 DCHECK(tab_to_sidebar_host_[tab].active_content_id != content_id); 324 DCHECK(tab_to_sidebar_host_[tab].active_content_id != content_id);
322 325
323 tab_to_sidebar_host_[tab].content_id_to_sidebar_host.erase(content_id); 326 tab_to_sidebar_host_[tab].content_id_to_sidebar_host.erase(content_id);
324 if (tab_to_sidebar_host_[tab].content_id_to_sidebar_host.empty()) 327 if (tab_to_sidebar_host_[tab].content_id_to_sidebar_host.empty())
325 tab_to_sidebar_host_.erase(tab); 328 tab_to_sidebar_host_.erase(tab);
326 sidebar_host_to_tab_.erase(sidebar_host); 329 sidebar_host_to_tab_.erase(sidebar_host);
327 } 330 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698