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

Side by Side Diff: chrome/browser/ui/panels/panel.cc

Issue 10965023: [Panels] Provide a tab id for web contents in Panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/panels/panel.h" 5 #include "chrome/browser/ui/panels/panel.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 base::DictionaryValue* 83 base::DictionaryValue*
84 PanelExtensionWindowController::CreateWindowValueWithTabs( 84 PanelExtensionWindowController::CreateWindowValueWithTabs(
85 const extensions::Extension* extension) const { 85 const extensions::Extension* extension) const {
86 base::DictionaryValue* result = CreateWindowValue(); 86 base::DictionaryValue* result = CreateWindowValue();
87 87
88 DCHECK(IsVisibleToExtension(extension)); 88 DCHECK(IsVisibleToExtension(extension));
89 content::WebContents* web_contents = panel_->GetWebContents(); 89 content::WebContents* web_contents = panel_->GetWebContents();
90 if (web_contents) { 90 if (web_contents) {
91 DictionaryValue* tab_value = new DictionaryValue(); 91 DictionaryValue* tab_value = new DictionaryValue();
92 // TabId must be >= 0. Use panel session id to avoid conflict with
93 // browser tab ids (which are also session ids).
94 tab_value->SetInteger(extensions::tabs_constants::kIdKey, 92 tab_value->SetInteger(extensions::tabs_constants::kIdKey,
95 panel_->session_id().id()); 93 SessionID::IdForTab(web_contents));
96 tab_value->SetInteger(extensions::tabs_constants::kIndexKey, 0); 94 tab_value->SetInteger(extensions::tabs_constants::kIndexKey, 0);
97 tab_value->SetInteger( 95 tab_value->SetInteger(extensions::tabs_constants::kWindowIdKey,
98 extensions::tabs_constants::kWindowIdKey, GetWindowId()); 96 SessionID::IdForWindowContainingTab(web_contents));
99 tab_value->SetString( 97 tab_value->SetString(
100 extensions::tabs_constants::kUrlKey, web_contents->GetURL().spec()); 98 extensions::tabs_constants::kUrlKey, web_contents->GetURL().spec());
101 tab_value->SetString(extensions::tabs_constants::kStatusKey, 99 tab_value->SetString(extensions::tabs_constants::kStatusKey,
102 ExtensionTabUtil::GetTabStatusText(web_contents->IsLoading())); 100 ExtensionTabUtil::GetTabStatusText(web_contents->IsLoading()));
103 tab_value->SetBoolean( 101 tab_value->SetBoolean(
104 extensions::tabs_constants::kActiveKey, panel_->IsActive()); 102 extensions::tabs_constants::kActiveKey, panel_->IsActive());
105 tab_value->SetBoolean(extensions::tabs_constants::kSelectedKey, true); 103 tab_value->SetBoolean(extensions::tabs_constants::kSelectedKey, true);
106 tab_value->SetBoolean(extensions::tabs_constants::kHighlightedKey, true); 104 tab_value->SetBoolean(extensions::tabs_constants::kHighlightedKey, true);
107 tab_value->SetBoolean(extensions::tabs_constants::kPinnedKey, false); 105 tab_value->SetBoolean(extensions::tabs_constants::kPinnedKey, false);
108 tab_value->SetString( 106 tab_value->SetString(
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 807
810 void Panel::OnImageLoaded(const gfx::Image& image, 808 void Panel::OnImageLoaded(const gfx::Image& image,
811 const std::string& extension_id, 809 const std::string& extension_id,
812 int index) { 810 int index) {
813 if (!image.IsEmpty()) { 811 if (!image.IsEmpty()) {
814 app_icon_ = image; 812 app_icon_ = image;
815 native_panel_->UpdatePanelTitleBar(); 813 native_panel_->UpdatePanelTitleBar();
816 } 814 }
817 app_icon_loader_.reset(); 815 app_icon_loader_.reset();
818 } 816 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698